bitkeeper revision 1.842.1.1 (40715b38BNfFZvL7yV9c1GJbSaAK0g)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Mon, 5 Apr 2004 13:12:24 +0000 (13:12 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Mon, 5 Apr 2004 13:12:24 +0000 (13:12 +0000)
Many files:
  new file
  Upgrade Xen APIC and ACPI and PCI subsystems to new features and fixes in latest Linux 2.4.
acpi.c:
  Rename: xen/arch/i386/acpitable.c -> xen/arch/i386/acpi.c
.del-acpitable.h~539b823a64c2b9d8:
  Delete: xen/arch/i386/acpitable.h

78 files changed:
.rootkeys
xen/Rules.mk
xen/arch/i386/acpi.c [new file with mode: 0644]
xen/arch/i386/acpitable.c [deleted file]
xen/arch/i386/acpitable.h [deleted file]
xen/arch/i386/apic.c
xen/arch/i386/io_apic.c
xen/arch/i386/mpparse.c
xen/arch/i386/pci-i386.c
xen/arch/i386/pci-i386.h
xen/arch/i386/pci-irq.c
xen/arch/i386/pci-pc.c
xen/arch/i386/setup.c
xen/drivers/Makefile
xen/drivers/acpi/Makefile [new file with mode: 0644]
xen/drivers/acpi/acpi_ksyms.c [new file with mode: 0644]
xen/drivers/acpi/tables.c [new file with mode: 0644]
xen/drivers/acpi_ksyms.c [new file with mode: 0644]
xen/drivers/ide/ide-probe.c
xen/drivers/pci/pci.c
xen/drivers/pci/pci.ids
xen/drivers/pci/quirks.c
xen/drivers/pci/setup-bus.c
xen/drivers/tables.c [new file with mode: 0644]
xen/include/acpi/acconfig.h [new file with mode: 0644]
xen/include/acpi/acdebug.h [new file with mode: 0644]
xen/include/acpi/acdisasm.h [new file with mode: 0644]
xen/include/acpi/acdispat.h [new file with mode: 0644]
xen/include/acpi/acevents.h [new file with mode: 0644]
xen/include/acpi/acexcep.h [new file with mode: 0644]
xen/include/acpi/acglobal.h [new file with mode: 0644]
xen/include/acpi/achware.h [new file with mode: 0644]
xen/include/acpi/acinterp.h [new file with mode: 0644]
xen/include/acpi/aclocal.h [new file with mode: 0644]
xen/include/acpi/acmacros.h [new file with mode: 0644]
xen/include/acpi/acnamesp.h [new file with mode: 0644]
xen/include/acpi/acobject.h [new file with mode: 0644]
xen/include/acpi/acoutput.h [new file with mode: 0644]
xen/include/acpi/acparser.h [new file with mode: 0644]
xen/include/acpi/acpi.h [new file with mode: 0644]
xen/include/acpi/acpi_bus.h [new file with mode: 0644]
xen/include/acpi/acpi_drivers.h [new file with mode: 0644]
xen/include/acpi/acpiosxf.h [new file with mode: 0644]
xen/include/acpi/acpixf.h [new file with mode: 0644]
xen/include/acpi/acresrc.h [new file with mode: 0644]
xen/include/acpi/acstruct.h [new file with mode: 0644]
xen/include/acpi/actables.h [new file with mode: 0644]
xen/include/acpi/actbl.h [new file with mode: 0644]
xen/include/acpi/actbl1.h [new file with mode: 0644]
xen/include/acpi/actbl2.h [new file with mode: 0644]
xen/include/acpi/actbl71.h [new file with mode: 0644]
xen/include/acpi/actypes.h [new file with mode: 0644]
xen/include/acpi/acutils.h [new file with mode: 0644]
xen/include/acpi/amlcode.h [new file with mode: 0644]
xen/include/acpi/amlresrc.h [new file with mode: 0644]
xen/include/acpi/platform/acenv.h [new file with mode: 0644]
xen/include/acpi/platform/acgcc.h [new file with mode: 0644]
xen/include/acpi/platform/aclinux.h [new file with mode: 0644]
xen/include/asm-i386/acpi.h [new file with mode: 0644]
xen/include/asm-i386/apic.h
xen/include/asm-i386/apicdef.h
xen/include/asm-i386/config.h
xen/include/asm-i386/cpufeature.h
xen/include/asm-i386/div64.h [new file with mode: 0644]
xen/include/asm-i386/dma.h
xen/include/asm-i386/fixmap.h
xen/include/asm-i386/hardirq.h
xen/include/asm-i386/hdreg.h
xen/include/asm-i386/io_apic.h
xen/include/asm-i386/mpspec.h
xen/include/asm-i386/pci.h
xen/include/asm-i386/processor.h
xen/include/asm-i386/smp.h
xen/include/asm-i386/smpboot.h
xen/include/asm-i386/time.h
xen/include/xen/acpi.h [new file with mode: 0644]
xen/include/xen/pci.h
xen/include/xen/pci_ids.h

index 57ac0c7f502ff40a8394f64572748a34e427904c..a3897fe397b556fd1cdef461d30f17f722228adc 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 3ddb79bcWnTwYsQRWl_PaneJfa6p0w xen/Rules.mk
 3ddb79bcZbRBzT3elFWSX7u6NtMagQ xen/arch/i386/Makefile
 3ddb79bcBQF85CfLS4i1WGZ4oLLaCA xen/arch/i386/Rules.mk
-3e5636e5FAYZ5_vQnmgwFJfSdmO5Mw xen/arch/i386/acpitable.c
-3e5636e7NRe-LqmOmyagUFWr70bcag xen/arch/i386/acpitable.h
+3e5636e5FAYZ5_vQnmgwFJfSdmO5Mw xen/arch/i386/acpi.c
 3ddb79bcsjinG9k1KcvbVBuas1R2dA xen/arch/i386/apic.c
 3ddb79bcSC_LvnmFlX-T5iTgaR0SKg xen/arch/i386/boot/boot.S
 3ddb79bcUrk2EIaM5VsT6wUudH1kkg xen/arch/i386/delay.c
 403a3edbejm33XLTGMuinKEwQBrOIg xen/common/trace.c
 3ddb79bd3zgV33PHdt-cgh3sxcb1hw xen/common/vsprintf.c
 3ddb79c0ppNeJtjC4va8j41ADCnchA xen/drivers/Makefile
+40715b2bi9gU43-cYzlmPDgreYQchw xen/drivers/acpi/Makefile
+40715b2bDxNCz5LFV8FAXihmYJZFUQ xen/drivers/acpi/acpi_ksyms.c
+40715b2cNVOegtvyft_AHFKJYRprfA xen/drivers/acpi/tables.c
+40715b2br9s0oHQxre-rWM8KSpa0RA xen/drivers/acpi_ksyms.c
 3ddb79beWzgPS8ozf2BL2g3ZkiWhhQ xen/drivers/block/Makefile
 3ddb79be04dyXzyXqDbMRS_1funwXQ xen/drivers/block/blkpg.c
 400be8220k_K_8-GFqi_KI7DtnG4wg xen/drivers/block/cciss.c
 3fd432fbFBLr85q2xIgdvDR7S2kvlw xen/drivers/scsi/sym53c8xx_2/sym_misc.c
 3fd432fbOri8Ue9-QTi6X-WviC2JYA xen/drivers/scsi/sym53c8xx_2/sym_misc.h
 3fd432fbM9qma6nz_-GWRpZ7v1pqrg xen/drivers/scsi/sym53c8xx_2/sym_nvram.c
+40715b2bZb6VFx6gPELSuItqa-E84w xen/drivers/tables.c
+40715b2cFpte_UNWnBZW0Du7z9AhTQ xen/include/acpi/acconfig.h
+40715b2cEQWX-PaxEH30qI48K1krnQ xen/include/acpi/acdebug.h
+40715b2c_7j-oy3ZNAuqE3IFNPzArg xen/include/acpi/acdisasm.h
+40715b2cFdcPx-2FHGM1Q-M-592xYQ xen/include/acpi/acdispat.h
+40715b2cKqD_Lihnlmvnyl4AAl3EFw xen/include/acpi/acevents.h
+40715b2ctNvVZ058w8eM8DR9hOat_A xen/include/acpi/acexcep.h
+40715b2com8I01qcHcAw47e93XsCqQ xen/include/acpi/acglobal.h
+40715b2cS1t4uI3sMsu-c0M4qqAIrw xen/include/acpi/achware.h
+40715b2chSz545A4Tq-y3WAtanzPMQ xen/include/acpi/acinterp.h
+40715b2cGf23lRI58NphiaDQl698-w xen/include/acpi/aclocal.h
+40715b2cdG7tCF2NMk0j1RCQQPzPXg xen/include/acpi/acmacros.h
+40715b2ckP2XZZDkSTehu6riuMogDA xen/include/acpi/acnamesp.h
+40715b2c4AvHYn2-2YIyt3mx-Mm5tw xen/include/acpi/acobject.h
+40715b2cPUXsHzmchvXx7QHAfW0nMw xen/include/acpi/acoutput.h
+40715b2cNbYpt9CHmCHg3RG7fBdACA xen/include/acpi/acparser.h
+40715b2cWM_6zR14U9Tp0s_q8D002A xen/include/acpi/acpi.h
+40715b2dcJDTiROgyMk9swD_veWktA xen/include/acpi/acpi_bus.h
+40715b2dRFlZK6apnH7WkUCBdyFXWA xen/include/acpi/acpi_drivers.h
+40715b2dtgZhNGAzlyBMe3kqve3mqw xen/include/acpi/acpiosxf.h
+40715b2dpW5TY7n5rzCufsDhJVWuMQ xen/include/acpi/acpixf.h
+40715b2dp9-_D9LTjcvtf-Yopih5mQ xen/include/acpi/acresrc.h
+40715b2djvd97KbIpt4wyJgxwqCqmg xen/include/acpi/acstruct.h
+40715b2dRIU9cQgmTjtCRNleIJDAYg xen/include/acpi/actables.h
+40715b2dy8ECRkSo9x0tRRueAjPx1g xen/include/acpi/actbl.h
+40715b2ds4J-XWn9Ix-lgBiJffNgxw xen/include/acpi/actbl1.h
+40715b2d_aMKMjKKNImJR4km52KRHA xen/include/acpi/actbl2.h
+40715b2dxC03aemijgL-iDH_-BkKRw xen/include/acpi/actbl71.h
+40715b2d0oQUijKwEw6SDJ4LhD8c4g xen/include/acpi/actypes.h
+40715b2dBByvcAtRpN5mafyEYLcBWA xen/include/acpi/acutils.h
+40715b2d_iPcZ0uUVGblPvjsHOwE5Q xen/include/acpi/amlcode.h
+40715b2d3CdS6dIpZDTiCJRlDG3LCA xen/include/acpi/amlresrc.h
+40715b2dKRW7A71SNaeV6zfrEzYxPw xen/include/acpi/platform/acenv.h
+40715b2d8fYydJMcODFrV1ocLklGDg xen/include/acpi/platform/acgcc.h
+40715b2d1yZkqyAt0kgx2xEwsatuuA xen/include/acpi/platform/aclinux.h
+40715b2dWe0tDhx9LkLXzTQkvD49RA xen/include/asm-i386/acpi.h
 3ddb79c3l4IiQtf6MS2jIzcd-hJS8g xen/include/asm-i386/apic.h
 3ddb79c3QJYWr8LLGdonLbWmNb9pQQ xen/include/asm-i386/apicdef.h
 3ddb79c3OiG9eTsi9Dy3F_OkuRAzKA xen/include/asm-i386/atomic.h
 3ddb79c2jFkPAZTDmU35L6IUssYMgQ xen/include/asm-i386/debugreg.h
 3ddb79c3r9-31dIsewPV3P3i8HALsQ xen/include/asm-i386/delay.h
 3ddb79c34BFiXjBJ_cCKB0aCsV1IDw xen/include/asm-i386/desc.h
+40715b2dTokMLYGSuD58BnxOqyWVew xen/include/asm-i386/div64.h
 3e564149UkU91RX7onzpCAmbj_IFjw xen/include/asm-i386/dma.h
 3e20b82fl1jmQiKdLy7fxMcutfpjWA xen/include/asm-i386/domain_page.h
 3ddb79c3NU8Zy40OTrq3D-i30Y3t4A xen/include/asm-i386/fixmap.h
 3ddb79c4yw_mfd4Uikn3v_IOPRpa1Q xen/include/scsi/scsicam.h
 3ddb79c4HKPMLvDBP9LxzPi_szVxGA xen/include/scsi/sg.h
 3e397e66m2tO3s-J8Jnr7Ws_tGoPTg xen/include/xen/ac_timer.h
+40715b2epYl2jBbxzz9CI2rgIca7Zg xen/include/xen/acpi.h
 3ddb79c0nTsjSpVK4ZVTI9WwN24xtQ xen/include/xen/blk.h
 3ddb79c0dVhTHLsv6CPTf4baKix4mA xen/include/xen/blkdev.h
 3ddb79c18ePBgitnOs7GiOCFilODVw xen/include/xen/blkpg.h
index 95bd10bab1a4da07c7d57a2587e40eb3e125bb07..440a05c925509afe8f899b093786d1bc84180cd3 100644 (file)
@@ -19,6 +19,7 @@ OBJS    += $(patsubst %.c,%.o,$(C_SRCS))
 # Note that link order matters!
 ALL_OBJS := $(BASEDIR)/common/common.o
 ALL_OBJS += $(BASEDIR)/drivers/char/driver.o
+ALL_OBJS += $(BASEDIR)/drivers/acpi/driver.o
 ALL_OBJS += $(BASEDIR)/drivers/pci/driver.o
 ifneq ($(nodev),y)
 ALL_OBJS += $(BASEDIR)/net/network.o
diff --git a/xen/arch/i386/acpi.c b/xen/arch/i386/acpi.c
new file mode 100644 (file)
index 0000000..ea621b7
--- /dev/null
@@ -0,0 +1,676 @@
+/*
+ *  acpi.c - Architecture-Specific Low-Level ACPI Support
+ *
+ *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *  Copyright (C) 2001 Jun Nakajima <jun.nakajima@intel.com>
+ *  Copyright (C) 2001 Patrick Mochel <mochel@osdl.org>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#include <xen/config.h>
+#include <xen/kernel.h>
+#include <xen/init.h>
+#include <xen/types.h>
+/*#include <xen/stddef.h>*/
+#include <xen/slab.h>
+#include <xen/pci.h>
+/*#include <xen/bootmem.h>*/
+#include <xen/irq.h>
+#include <xen/acpi.h>
+#include <asm/mpspec.h>
+#include <asm/io.h>
+#include <asm/apic.h>
+#include <asm/apicdef.h>
+#include <asm/page.h>
+/*#include <asm/pgtable.h>*/
+#include <asm/pgalloc.h>
+#include <asm/io_apic.h>
+#include <asm/acpi.h>
+/*#include <asm/save_state.h>*/
+#include <asm/smpboot.h>
+
+
+#define PREFIX                 "ACPI: "
+
+int acpi_lapic = 0;
+int acpi_ioapic = 0;
+
+/* --------------------------------------------------------------------------
+                              Boot-time Configuration
+   -------------------------------------------------------------------------- */
+
+#ifdef CONFIG_ACPI_BOOT
+int acpi_noirq __initdata = 0;  /* skip ACPI IRQ initialization */
+int acpi_ht __initdata = 1;     /* enable HT */
+
+enum acpi_irq_model_id         acpi_irq_model;
+
+
+/*
+ * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
+ * to map the target physical address. The problem is that set_fixmap()
+ * provides a single page, and it is possible that the page is not
+ * sufficient.
+ * By using this area, we can map up to MAX_IO_APICS pages temporarily,
+ * i.e. until the next __va_range() call.
+ *
+ * Important Safety Note:  The fixed I/O APIC page numbers are *subtracted*
+ * from the fixed base.  That's why we start at FIX_IO_APIC_BASE_END and
+ * count idx down while incrementing the phys address.
+ */
+char *__acpi_map_table(unsigned long phys, unsigned long size)
+{
+       unsigned long base, offset, mapped_size;
+       int idx;
+
+       if (phys + size < 8*1024*1024) 
+               return __va(phys); 
+
+       offset = phys & (PAGE_SIZE - 1);
+       mapped_size = PAGE_SIZE - offset;
+       set_fixmap(FIX_ACPI_END, phys);
+       base = fix_to_virt(FIX_ACPI_END);
+
+       /*
+        * Most cases can be covered by the below.
+        */
+       idx = FIX_ACPI_END;
+       while (mapped_size < size) {
+               if (--idx < FIX_ACPI_BEGIN)
+                       return 0;       /* cannot handle this */
+               phys += PAGE_SIZE;
+               set_fixmap(idx, phys);
+               mapped_size += PAGE_SIZE;
+       }
+
+       return ((unsigned char *) base + offset);
+}
+
+
+#ifdef CONFIG_X86_LOCAL_APIC
+
+static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
+
+
+static int __init
+acpi_parse_madt (
+       unsigned long           phys_addr,
+       unsigned long           size)
+{
+       struct acpi_table_madt  *madt = NULL;
+
+       if (!phys_addr || !size)
+               return -EINVAL;
+
+       madt = (struct acpi_table_madt *) __acpi_map_table(phys_addr, size);
+       if (!madt) {
+               printk(KERN_WARNING PREFIX "Unable to map MADT\n");
+               return -ENODEV;
+       }
+
+       if (madt->lapic_address)
+               acpi_lapic_addr = (u64) madt->lapic_address;
+
+       printk(KERN_INFO PREFIX "Local APIC address 0x%08x\n",
+               madt->lapic_address);
+
+       detect_clustered_apic(madt->header.oem_id, madt->header.oem_table_id);
+
+       return 0;
+}
+
+
+static int __init
+acpi_parse_lapic (
+       acpi_table_entry_header *header)
+{
+       struct acpi_table_lapic *processor = NULL;
+
+       processor = (struct acpi_table_lapic*) header;
+       if (!processor)
+               return -EINVAL;
+
+       acpi_table_print_madt_entry(header);
+
+       mp_register_lapic (
+               processor->id,                                     /* APIC ID */
+               processor->flags.enabled);                        /* Enabled? */
+
+       return 0;
+}
+
+
+static int __init
+acpi_parse_lapic_addr_ovr (
+       acpi_table_entry_header *header)
+{
+       struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL;
+
+       lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr*) header;
+       if (!lapic_addr_ovr)
+               return -EINVAL;
+
+       acpi_lapic_addr = lapic_addr_ovr->address;
+
+       return 0;
+}
+
+static int __init
+acpi_parse_lapic_nmi (
+       acpi_table_entry_header *header)
+{
+       struct acpi_table_lapic_nmi *lapic_nmi = NULL;
+
+       lapic_nmi = (struct acpi_table_lapic_nmi*) header;
+       if (!lapic_nmi)
+               return -EINVAL;
+
+       acpi_table_print_madt_entry(header);
+
+       if (lapic_nmi->lint != 1)
+               printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
+
+       return 0;
+}
+
+#endif /*CONFIG_X86_LOCAL_APIC*/
+
+#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
+
+static int __init
+acpi_parse_ioapic (
+       acpi_table_entry_header *header)
+{
+       struct acpi_table_ioapic *ioapic = NULL;
+
+       ioapic = (struct acpi_table_ioapic*) header;
+       if (!ioapic)
+               return -EINVAL;
+       acpi_table_print_madt_entry(header);
+
+       mp_register_ioapic (
+               ioapic->id,
+               ioapic->address,
+               ioapic->global_irq_base);
+       return 0;
+}
+
+
+static int __init
+acpi_parse_int_src_ovr (
+       acpi_table_entry_header *header)
+{
+       struct acpi_table_int_src_ovr *intsrc = NULL;
+
+       intsrc = (struct acpi_table_int_src_ovr*) header;
+       if (!intsrc)
+               return -EINVAL;
+
+       acpi_table_print_madt_entry(header);
+
+       mp_override_legacy_irq (
+               intsrc->bus_irq,
+               intsrc->flags.polarity,
+               intsrc->flags.trigger,
+               intsrc->global_irq);
+
+       return 0;
+}
+
+
+static int __init
+acpi_parse_nmi_src (
+       acpi_table_entry_header *header)
+{
+       struct acpi_table_nmi_src *nmi_src = NULL;
+
+       nmi_src = (struct acpi_table_nmi_src*) header;
+       if (!nmi_src)
+               return -EINVAL;
+
+       acpi_table_print_madt_entry(header);
+
+       /* TBD: Support nimsrc entries? */
+
+       return 0;
+}
+
+#endif /*CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER*/
+
+
+static unsigned long __init
+acpi_scan_rsdp (
+       unsigned long           start,
+       unsigned long           length)
+{
+       unsigned long           offset = 0;
+       unsigned long           sig_len = sizeof("RSD PTR ") - 1;
+
+       /*
+        * Scan all 16-byte boundaries of the physical memory region for the
+        * RSDP signature.
+        */
+       for (offset = 0; offset < length; offset += 16) {
+               if (strncmp((char *) (start + offset), "RSD PTR ", sig_len))
+                       continue;
+               return (start + offset);
+       }
+
+       return 0;
+}
+
+
+unsigned long __init
+acpi_find_rsdp (void)
+{
+       unsigned long           rsdp_phys = 0;
+
+       /*
+        * Scan memory looking for the RSDP signature. First search EBDA (low
+        * memory) paragraphs and then search upper memory (E0000-FFFFF).
+        */
+       rsdp_phys = acpi_scan_rsdp (0, 0x400);
+       if (!rsdp_phys)
+               rsdp_phys = acpi_scan_rsdp (0xE0000, 0xFFFFF);
+
+       return rsdp_phys;
+}
+
+
+/*
+ * acpi_boot_init()
+ *  called from setup_arch(), always.
+ *     1. maps ACPI tables for later use
+ *     2. enumerates lapics
+ *     3. enumerates io-apics
+ *
+ * side effects:
+ *     acpi_lapic = 1 if LAPIC found
+ *     acpi_ioapic = 1 if IOAPIC found
+ *     if (acpi_lapic && acpi_ioapic) smp_found_config = 1;
+ *     if acpi_blacklisted() acpi_disabled = 1;
+ *     acpi_irq_model=...
+ *     ...
+ *
+ * return value: (currently ignored)
+ *     0: success
+ *     !0: failure
+ */
+int __init
+acpi_boot_init (void)
+{
+       int                     result = 0;
+
+       if (acpi_disabled && !acpi_ht)
+               return(1);
+
+       /*
+        * The default interrupt routing model is PIC (8259).  This gets
+        * overriden if IOAPICs are enumerated (below).
+        */
+       acpi_irq_model = ACPI_IRQ_MODEL_PIC;
+
+       /* 
+        * Initialize the ACPI boot-time table parser.
+        */
+       result = acpi_table_init();
+       if (result) {
+               acpi_disabled = 1;
+               return result;
+       }
+
+       result = acpi_blacklisted();
+       if (result) {
+               printk(KERN_NOTICE PREFIX "BIOS listed in blacklist, disabling ACPI support\n");
+               acpi_disabled = 1;
+               return result;
+       }
+
+#ifdef CONFIG_X86_LOCAL_APIC
+
+       /* 
+        * MADT
+        * ----
+        * Parse the Multiple APIC Description Table (MADT), if exists.
+        * Note that this table provides platform SMP configuration 
+        * information -- the successor to MPS tables.
+        */
+
+       result = acpi_table_parse(ACPI_APIC, acpi_parse_madt);
+       if (!result) {
+               return 0;
+       }
+       else if (result < 0) {
+               printk(KERN_ERR PREFIX "Error parsing MADT\n");
+               return result;
+       }
+       else if (result > 1) 
+               printk(KERN_WARNING PREFIX "Multiple MADT tables exist\n");
+
+       /* 
+        * Local APIC
+        * ----------
+        * Note that the LAPIC address is obtained from the MADT (32-bit value)
+        * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
+        */
+
+       result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr);
+       if (result < 0) {
+               printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
+               return result;
+       }
+
+       mp_register_lapic_address(acpi_lapic_addr);
+
+       result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic);
+       if (!result) { 
+               printk(KERN_ERR PREFIX "No LAPIC entries present\n");
+               /* TBD: Cleanup to allow fallback to MPS */
+               return -ENODEV;
+       }
+       else if (result < 0) {
+               printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
+               /* TBD: Cleanup to allow fallback to MPS */
+               return result;
+       }
+
+       result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi);
+       if (result < 0) {
+               printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
+               /* TBD: Cleanup to allow fallback to MPS */
+               return result;
+       }
+
+       acpi_lapic = 1;
+
+#endif /*CONFIG_X86_LOCAL_APIC*/
+
+#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
+
+       /* 
+        * I/O APIC 
+        * --------
+        */
+
+       /*
+        * ACPI interpreter is required to complete interrupt setup,
+        * so if it is off, don't enumerate the io-apics with ACPI.
+        * If MPS is present, it will handle them,
+        * otherwise the system will stay in PIC mode
+        */
+       if (acpi_disabled || acpi_noirq) {
+               return 1;
+       }
+
+       /*
+        * if "noapic" boot option, don't look for IO-APICs
+        */
+       if (ioapic_setup_disabled()) {
+               printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
+                       "due to 'noapic' option.\n");
+               return 1;
+        }
+
+
+       result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic);
+       if (!result) { 
+               printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
+               return -ENODEV;
+       }
+       else if (result < 0) {
+               printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
+               return result;
+       }
+
+       /* Build a default routing table for legacy (ISA) interrupts. */
+       mp_config_acpi_legacy_irqs();
+
+       result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr);
+       if (result < 0) {
+               printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
+               /* TBD: Cleanup to allow fallback to MPS */
+               return result;
+       }
+
+       result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src);
+       if (result < 0) {
+               printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
+               /* TBD: Cleanup to allow fallback to MPS */
+               return result;
+       }
+
+       acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
+
+       acpi_irq_balance_set(NULL);
+
+       acpi_ioapic = 1;
+
+       if (acpi_lapic && acpi_ioapic)
+               smp_found_config = 1;
+
+#endif /*CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER*/
+
+       return 0;
+}
+
+#endif /*CONFIG_ACPI_BOOT*/
+
+#ifdef CONFIG_ACPI_BUS
+/*
+ * "acpi_pic_sci=level" (current default)
+ * programs the PIC-mode SCI to Level Trigger.
+ * (NO-OP if the BIOS set Level Trigger already)
+ *
+ * If a PIC-mode SCI is not recogznied or gives spurious IRQ7's
+ * it may require Edge Trigger -- use "acpi_pic_sci=edge"
+ * (NO-OP if the BIOS set Edge Trigger already)
+ *
+ * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers
+ * for the 8259 PIC.  bit[n] = 1 means irq[n] is Level, otherwise Edge.
+ * ECLR1 is IRQ's 0-7 (IRQ 0, 1, 2 must be 0)
+ * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0)
+ */
+
+static __initdata int  acpi_pic_sci_trigger;   /* 0: level, 1: edge */
+
+void __init
+acpi_pic_sci_set_trigger(unsigned int irq)
+{
+       unsigned char mask = 1 << (irq & 7);
+       unsigned int port = 0x4d0 + (irq >> 3);
+       unsigned char val = inb(port);
+
+       
+       printk(PREFIX "IRQ%d SCI:", irq);
+       if (!(val & mask)) {
+               printk(" Edge");
+
+               if (!acpi_pic_sci_trigger) {
+                       printk(" set to Level");
+                       outb(val | mask, port);
+               }
+       } else {
+               printk(" Level");
+
+               if (acpi_pic_sci_trigger) {
+                       printk(" set to Edge");
+                       outb(val | mask, port);
+               }
+       }
+       printk(" Trigger.\n");
+}
+
+int __init
+acpi_pic_sci_setup(char *str)
+{
+       while (str && *str) {
+               if (strncmp(str, "level", 5) == 0)
+                       acpi_pic_sci_trigger = 0;       /* force level trigger */
+               if (strncmp(str, "edge", 4) == 0)
+                       acpi_pic_sci_trigger = 1;       /* force edge trigger */
+               str = strchr(str, ',');
+               if (str)
+                       str += strspn(str, ", \t");
+       }
+       return 1;
+}
+
+__setup("acpi_pic_sci=", acpi_pic_sci_setup);
+
+#endif /* CONFIG_ACPI_BUS */
+
+
+
+/* --------------------------------------------------------------------------
+                              Low-Level Sleep Support
+   -------------------------------------------------------------------------- */
+
+#ifdef CONFIG_ACPI_SLEEP
+
+#define DEBUG
+
+#ifdef DEBUG
+#include <xen/serial.h>
+#endif
+
+/* address in low memory of the wakeup routine. */
+unsigned long acpi_wakeup_address = 0;
+
+/* new page directory that we will be using */
+static pmd_t *pmd;
+
+/* saved page directory */
+static pmd_t saved_pmd;
+
+/* page which we'll use for the new page directory */
+static pte_t *ptep;
+
+extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
+
+/*
+ * acpi_create_identity_pmd
+ *
+ * Create a new, identity mapped pmd.
+ *
+ * Do this by creating new page directory, and marking all the pages as R/W
+ * Then set it as the new Page Middle Directory.
+ * And, of course, flush the TLB so it takes effect.
+ *
+ * We save the address of the old one, for later restoration.
+ */
+static void acpi_create_identity_pmd (void)
+{
+       pgd_t *pgd;
+       int i;
+
+       ptep = (pte_t*)__get_free_page(GFP_KERNEL);
+
+       /* fill page with low mapping */
+       for (i = 0; i < PTRS_PER_PTE; i++)
+               set_pte(ptep + i, mk_pte_phys(i << PAGE_SHIFT, PAGE_SHARED));
+
+       pgd = pgd_offset(current->active_mm, 0);
+       pmd = pmd_alloc(current->mm,pgd, 0);
+
+       /* save the old pmd */
+       saved_pmd = *pmd;
+
+       /* set the new one */
+       set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(ptep)));
+
+       /* flush the TLB */
+       local_flush_tlb();
+}
+
+/*
+ * acpi_restore_pmd
+ *
+ * Restore the old pmd saved by acpi_create_identity_pmd and
+ * free the page that said function alloc'd
+ */
+static void acpi_restore_pmd (void)
+{
+       set_pmd(pmd, saved_pmd);
+       local_flush_tlb();
+       free_page((unsigned long)ptep);
+}
+
+/**
+ * acpi_save_state_mem - save kernel state
+ *
+ * Create an identity mapped page table and copy the wakeup routine to
+ * low memory.
+ */
+int acpi_save_state_mem (void)
+{
+       acpi_create_identity_pmd();
+       acpi_copy_wakeup_routine(acpi_wakeup_address);
+
+       return 0;
+}
+
+/**
+ * acpi_save_state_disk - save kernel state to disk
+ *
+ */
+int acpi_save_state_disk (void)
+{
+       return 1;
+}
+
+/*
+ * acpi_restore_state
+ */
+void acpi_restore_state_mem (void)
+{
+       acpi_restore_pmd();
+}
+
+/**
+ * acpi_reserve_bootmem - do _very_ early ACPI initialisation
+ *
+ * We allocate a page in low memory for the wakeup
+ * routine for when we come back from a sleep state. The
+ * runtime allocator allows specification of <16M pages, but not
+ * <1M pages.
+ */
+void __init acpi_reserve_bootmem(void)
+{
+       acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
+       printk(KERN_DEBUG "ACPI: have wakeup address 0x%8.8lx\n", acpi_wakeup_address);
+}
+
+void do_suspend_lowlevel_s4bios(int resume)
+{
+       if (!resume) {
+               save_processor_context();
+               acpi_save_register_state((unsigned long)&&acpi_sleep_done);
+               acpi_enter_sleep_state_s4bios();
+               return;
+       }
+acpi_sleep_done:
+       restore_processor_context();
+}
+
+
+#endif /*CONFIG_ACPI_SLEEP*/
+
diff --git a/xen/arch/i386/acpitable.c b/xen/arch/i386/acpitable.c
deleted file mode 100644 (file)
index 1d52871..0000000
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- *  acpitable.c - IA32-specific ACPI boot-time initialization (Revision: 1)
- *
- *  Copyright (C) 1999 Andrew Henroid
- *  Copyright (C) 2001 Richard Schaal
- *  Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
- *  Copyright (C) 2001 Jun Nakajima <jun.nakajima@intel.com>
- *  Copyright (C) 2001 Arjan van de Ven <arjanv@redhat.com>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * $Id: acpitable.c,v 1.7 2001/11/04 12:21:18 fenrus Exp $
- */
-#include <xen/config.h>
-#include <xen/kernel.h>
-#include <xen/init.h>
-#include <xen/types.h>
-#include <xen/slab.h>
-#include <xen/pci.h>
-#include <asm/mpspec.h>
-#include <asm/io.h>
-#include <asm/apic.h>
-#include <asm/apicdef.h>
-#include <asm/page.h>
-#include <asm/io_apic.h>
-
-#ifdef CONFIG_X86_IO_APIC
-
-#include "acpitable.h"
-
-static acpi_table_handler acpi_boot_ops[ACPI_TABLE_COUNT];
-
-
-static unsigned char __init
-acpi_checksum(void *buffer, int length)
-{
-       int i;
-       unsigned char *bytebuffer;
-       unsigned char sum = 0;
-
-       if (!buffer || length <= 0)
-               return 0;
-
-       bytebuffer = (unsigned char *) buffer;
-
-       for (i = 0; i < length; i++)
-               sum += *(bytebuffer++);
-
-       return sum;
-}
-
-static void __init
-acpi_print_table_header(acpi_table_header * header)
-{
-       if (!header)
-               return;
-
-       printk(KERN_INFO "ACPI table found: %.4s v%d [%.6s %.8s %d.%d]\n",
-              header->signature, header->revision, header->oem_id,
-              header->oem_table_id, header->oem_revision >> 16,
-              header->oem_revision & 0xffff);
-
-       return;
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_tb_scan_memory_for_rsdp
- *
- * PARAMETERS:  address       - Starting pointer for search
- *              length        - Maximum length to search
- *
- * RETURN:      Pointer to the RSDP if found and valid, otherwise NULL.
- *
- * DESCRIPTION: Search a block of memory for the RSDP signature
- *
- ******************************************************************************/
-
-static void *__init
-acpi_tb_scan_memory_for_rsdp(void *address, int length)
-{
-       u32 offset;
-
-       if (length <= 0)
-               return NULL;
-
-       /* Search from given start addr for the requested length  */
-
-       offset = 0;
-
-       while (offset < length) {
-               /* The signature must match and the checksum must be correct */
-               if (strncmp(address, RSDP_SIG, sizeof(RSDP_SIG) - 1) == 0 &&
-                   acpi_checksum(address, RSDP_CHECKSUM_LENGTH) == 0) {
-                       /* If so, we have found the RSDP */
-                       printk(KERN_INFO "ACPI: RSDP located at physical address %p\n",
-                              address);
-                       return address;
-               }
-               offset += RSDP_SCAN_STEP;
-               address += RSDP_SCAN_STEP;
-       }
-
-       /* Searched entire block, no RSDP was found */
-       printk(KERN_INFO "ACPI: Searched entire block, no RSDP was found.\n");
-       return NULL;
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_find_root_pointer
- *
- * PARAMETERS:  none
- *
- * RETURN:      physical address of the RSDP 
- *
- * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor
- *              pointer structure.  If it is found, set *RSDP to point to it.
- *
- *              NOTE: The RSDP must be either in the first 1_k of the Extended
- *              BIOS Data Area or between E0000 and FFFFF (ACPI 1.0 section
- *              5.2.2; assertion #421).
- *
- ******************************************************************************/
-
-static struct acpi_table_rsdp * __init
-acpi_find_root_pointer(void)
-{
-       struct acpi_table_rsdp * rsdp;
-
-       /*
-        * Physical address is given
-        */
-       /*
-        * Region 1) Search EBDA (low memory) paragraphs
-        */
-       rsdp = acpi_tb_scan_memory_for_rsdp(__va(LO_RSDP_WINDOW_BASE),
-                                        LO_RSDP_WINDOW_SIZE);
-
-       if (rsdp)
-               return rsdp;
-
-       /*
-        * Region 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
-        */
-       rsdp = acpi_tb_scan_memory_for_rsdp(__va(HI_RSDP_WINDOW_BASE),
-                                              HI_RSDP_WINDOW_SIZE);
-
-       
-                                            
-       if (rsdp)
-               return rsdp;
-
-       printk(KERN_ERR "ACPI: System description tables not found\n");
-       return NULL;
-}
-
-
-/*
- * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
- * to map the target physical address. The problem is that set_fixmap()
- * provides a single page, and it is possible that the page is not
- * sufficient.
- * By using this area, we can map up to MAX_IO_APICS pages temporarily,
- * i.e. until the next __va_range() call.
- *
- * Important Safety Note:  The fixed I/O APIC page numbers are *subtracted*
- * from the fixed base.  That's why we start at FIX_IO_APIC_BASE_END and
- * count idx down while incrementing the phys address.
- */
-static __init char *
-__va_range(unsigned long phys, unsigned long size)
-{
-       unsigned long base, offset, mapped_size;
-       int idx;
-
-       offset = phys & (PAGE_SIZE - 1);
-       mapped_size = PAGE_SIZE - offset;
-       set_fixmap(FIX_IO_APIC_BASE_END, phys);
-       base = fix_to_virt(FIX_IO_APIC_BASE_END);
-       dprintk("__va_range(0x%lx, 0x%lx): idx=%d mapped at %lx\n", phys, size,
-               FIX_IO_APIC_BASE_END, base);
-
-       /*
-        * Most cases can be covered by the below.
-        */
-       idx = FIX_IO_APIC_BASE_END;
-       while (mapped_size < size) {
-               if (--idx < FIX_IO_APIC_BASE_0)
-                       return 0;       /* cannot handle this */
-               phys += PAGE_SIZE;
-               set_fixmap(idx, phys);
-               mapped_size += PAGE_SIZE;
-       }
-
-       return ((unsigned char *) base + offset);
-}
-
-static int __init acpi_tables_init(void)
-{
-       int result = -ENODEV;
-       acpi_table_header *header = NULL;
-       struct acpi_table_rsdp *rsdp = NULL;
-       struct acpi_table_rsdt *rsdt = NULL;
-       struct acpi_table_rsdt saved_rsdt;
-       int tables = 0;
-       int type = 0;
-       int i = 0;
-
-
-       rsdp = (struct acpi_table_rsdp *) acpi_find_root_pointer();
-
-       if (!rsdp)
-               return -ENODEV;
-               
-       printk(KERN_INFO "%.8s v%d [%.6s]\n", rsdp->signature, rsdp->revision,
-              rsdp->oem_id);
-              
-       if (strncmp(rsdp->signature, RSDP_SIG,strlen(RSDP_SIG))) {
-               printk(KERN_WARNING "RSDP table signature incorrect\n");
-               return -EINVAL;
-       }
-
-       rsdt = (struct acpi_table_rsdt *)
-           __va_range(rsdp->rsdt_address, sizeof(struct acpi_table_rsdt));
-
-       if (!rsdt) {
-               printk(KERN_WARNING "ACPI: Invalid root system description tables (RSDT)\n");
-               return -ENODEV;
-       }
-       
-       header = & rsdt->header;
-       acpi_print_table_header(header);
-       
-       if (strncmp(header->signature, RSDT_SIG, strlen(RSDT_SIG))) {
-               printk(KERN_WARNING "ACPI: RSDT signature incorrect\n");
-               return -ENODEV;
-       }
-               
-       /* 
-        * The number of tables is computed by taking the 
-        * size of all entries (header size minus total 
-        * size of RSDT) divided by the size of each entry
-        * (4-byte table pointers).
-        */
-       tables = (header->length - sizeof(acpi_table_header)) / 4;
-                   
-       memcpy(&saved_rsdt, rsdt, sizeof(saved_rsdt));
-
-       if (saved_rsdt.header.length > sizeof(saved_rsdt)) {
-               printk(KERN_WARNING "ACPI: Too big length in RSDT: %d\n", saved_rsdt.header.length);
-               return -ENODEV;
-       }
-
-       for (i = 0; i < tables; i++) {
-               /* Map in header, then map in full table length. */
-               header = (acpi_table_header *)
-                           __va_range(saved_rsdt.entry[i],
-                                      sizeof(acpi_table_header));
-               if (!header)
-                       break;
-               header = (acpi_table_header *)
-                           __va_range(saved_rsdt.entry[i], header->length);
-               if (!header)
-                       break;
-
-               acpi_print_table_header(header);
-               
-               if (acpi_checksum(header,header->length)) {
-                       printk(KERN_WARNING "ACPI %s has invalid checksum\n", 
-                               acpi_table_signatures[i]);
-                       continue;
-               }
-               
-               for (type = 0; type < ACPI_TABLE_COUNT; type++)
-                       if (!strncmp((char *) &header->signature,
-                            acpi_table_signatures[type],strlen(acpi_table_signatures[type])))
-                               break;
-
-               if (type >= ACPI_TABLE_COUNT) {
-                       printk(KERN_WARNING "ACPI: Unsupported table %.4s\n",
-                              header->signature);
-                       continue;
-               }
-
-
-               if (!acpi_boot_ops[type])
-                       continue;
-                       
-               result = acpi_boot_ops[type] (header,
-                                                (unsigned long) saved_rsdt.
-                                                entry[i]);
-       }
-
-       return result;
-}
-
-static int total_cpus __initdata = 0;
-int have_acpi_tables;
-
-extern void __init MP_processor_info(struct mpc_config_processor *);
-
-static void __init
-acpi_parse_lapic(struct acpi_table_lapic *local_apic)
-{
-       struct mpc_config_processor proc_entry;
-       int ix = 0;
-
-       if (!local_apic)
-               return;
-
-       printk(KERN_INFO "LAPIC (acpi_id[0x%04x] id[0x%x] enabled[%d])\n",
-               local_apic->acpi_id, local_apic->id, local_apic->flags.enabled);
-
-       printk(KERN_INFO "CPU %d (0x%02x00)", total_cpus, local_apic->id);
-
-       if (local_apic->flags.enabled) {
-               printk(" enabled");
-               ix = local_apic->id;
-               if (ix >= MAX_APICS) {
-                       printk(KERN_WARNING
-                              "Processor #%d INVALID - (Max ID: %d).\n", ix,
-                              MAX_APICS);
-                       return;
-               }
-               /* 
-                * Fill in the info we want to save.  Not concerned about 
-                * the processor ID.  Processor features aren't present in 
-                * the table.
-                */
-               proc_entry.mpc_type = MP_PROCESSOR;
-               proc_entry.mpc_apicid = local_apic->id;
-               proc_entry.mpc_cpuflag = CPU_ENABLED;
-               if (proc_entry.mpc_apicid == boot_cpu_physical_apicid) {
-                       printk(" (BSP)");
-                       proc_entry.mpc_cpuflag |= CPU_BOOTPROCESSOR;
-               }
-               proc_entry.mpc_cpufeature =
-                   (boot_cpu_data.x86 << 8) | 
-                   (boot_cpu_data.x86_model << 4) | 
-                    boot_cpu_data.x86_mask;
-               proc_entry.mpc_featureflag = boot_cpu_data.x86_capability[0];
-               proc_entry.mpc_reserved[0] = 0;
-               proc_entry.mpc_reserved[1] = 0;
-               proc_entry.mpc_apicver = 0x10;  /* integrated APIC */
-               MP_processor_info(&proc_entry);
-       } else {
-               printk(" disabled");
-       }
-       printk("\n");
-
-       total_cpus++;
-       return;
-}
-
-static void __init
-acpi_parse_ioapic(struct acpi_table_ioapic *ioapic)
-{
-
-       if (!ioapic)
-               return;
-
-       printk(KERN_INFO
-              "IOAPIC (id[0x%x] address[0x%x] global_irq_base[0x%x])\n",
-              ioapic->id, ioapic->address, ioapic->global_irq_base);
-
-       if (nr_ioapics >= MAX_IO_APICS) {
-               printk(KERN_WARNING
-                      "Max # of I/O APICs (%d) exceeded (found %d).\n",
-                      MAX_IO_APICS, nr_ioapics);
-/*             panic("Recompile kernel with bigger MAX_IO_APICS!\n");   */
-       }
-}
-
-
-/* Interrupt source overrides inform the machine about exceptions
-   to the normal "PIC" mode interrupt routing */
-   
-static void __init
-acpi_parse_int_src_ovr(struct acpi_table_int_src_ovr *intsrc)
-{
-       if (!intsrc)
-               return;
-
-       printk(KERN_INFO
-              "INT_SRC_OVR (bus[%d] irq[0x%x] global_irq[0x%x] polarity[0x%x] trigger[0x%x])\n",
-              intsrc->bus, intsrc->bus_irq, intsrc->global_irq,
-              intsrc->flags.polarity, intsrc->flags.trigger);
-}
-
-/*
- * At this point, we look at the interrupt assignment entries in the MPS
- * table.
- */ 
-static void __init acpi_parse_nmi_src(struct acpi_table_nmi_src *nmisrc)
-{
-       if (!nmisrc)
-               return;
-
-       printk(KERN_INFO
-              "NMI_SRC (polarity[0x%x] trigger[0x%x] global_irq[0x%x])\n",
-              nmisrc->flags.polarity, nmisrc->flags.trigger,
-              nmisrc->global_irq);
-
-}
-static void __init
-acpi_parse_lapic_nmi(struct acpi_table_lapic_nmi *localnmi)
-{
-       if (!localnmi)
-               return;
-
-       printk(KERN_INFO
-              "LAPIC_NMI (acpi_id[0x%04x] polarity[0x%x] trigger[0x%x] lint[0x%x])\n",
-              localnmi->acpi_id, localnmi->flags.polarity,
-              localnmi->flags.trigger, localnmi->lint);
-}
-static void __init
-acpi_parse_lapic_addr_ovr(struct acpi_table_lapic_addr_ovr *lapic_addr_ovr)
-{
-       if (!lapic_addr_ovr)
-               return;
-
-       printk(KERN_INFO "LAPIC_ADDR_OVR (address[0x%lx])\n",
-              (unsigned long) lapic_addr_ovr->address);
-
-}
-
-static void __init
-acpi_parse_plat_int_src(struct acpi_table_plat_int_src *plintsrc)
-{
-       if (!plintsrc)
-               return;
-
-       printk(KERN_INFO
-              "PLAT_INT_SRC (polarity[0x%x] trigger[0x%x] type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
-              plintsrc->flags.polarity, plintsrc->flags.trigger,
-              plintsrc->type, plintsrc->id, plintsrc->eid,
-              plintsrc->iosapic_vector, plintsrc->global_irq);
-}
-static int __init
-acpi_parse_madt(acpi_table_header * header, unsigned long phys)
-{
-
-       struct acpi_table_madt *madt;       
-       acpi_madt_entry_header *entry_header;
-       int table_size;
-       
-       madt = (struct acpi_table_madt *) __va_range(phys, header->length);
-
-       if (!madt)
-               return -EINVAL;
-
-       table_size = (int) (header->length - sizeof(*madt));
-       entry_header =
-           (acpi_madt_entry_header *) ((void *) madt + sizeof(*madt));
-
-       while (entry_header && (table_size > 0)) {
-               switch (entry_header->type) {
-               case ACPI_MADT_LAPIC:
-                       acpi_parse_lapic((struct acpi_table_lapic *)
-                                        entry_header);
-                       break;
-               case ACPI_MADT_IOAPIC:
-                       acpi_parse_ioapic((struct acpi_table_ioapic *)
-                                         entry_header);
-                       break;
-               case ACPI_MADT_INT_SRC_OVR:
-                       acpi_parse_int_src_ovr((struct acpi_table_int_src_ovr *)
-                                              entry_header);
-                       break;
-               case ACPI_MADT_NMI_SRC:
-                       acpi_parse_nmi_src((struct acpi_table_nmi_src *)
-                                          entry_header);
-                       break;
-               case ACPI_MADT_LAPIC_NMI:
-                       acpi_parse_lapic_nmi((struct acpi_table_lapic_nmi *)
-                                            entry_header);
-                       break;
-               case ACPI_MADT_LAPIC_ADDR_OVR:
-                       acpi_parse_lapic_addr_ovr((struct
-                                                  acpi_table_lapic_addr_ovr *)
-                                                 entry_header);
-                       break;
-               case ACPI_MADT_PLAT_INT_SRC:
-                       acpi_parse_plat_int_src((struct acpi_table_plat_int_src
-                                                *) entry_header);
-                       break;
-               default:
-                       printk(KERN_WARNING
-                              "Unsupported MADT entry type 0x%x\n",
-                              entry_header->type);
-                       break;
-               }
-               table_size -= entry_header->length;
-               entry_header =
-                   (acpi_madt_entry_header *) ((void *) entry_header +
-                                               entry_header->length);
-       }
-
-       if (!total_cpus) {
-               printk("ACPI: No Processors found in the APCI table.\n");
-               return -EINVAL;
-       }
-
-       printk(KERN_INFO "%d CPUs total\n", total_cpus);
-
-       if (madt->lapic_address)
-               mp_lapic_addr = madt->lapic_address;
-       else
-               mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
-
-       printk(KERN_INFO "Local APIC address %x\n", madt->lapic_address);
-
-       return 0;
-}
-
-extern int opt_noacpi;
-
-/*
- * Configure the processor info using MADT in the ACPI tables. If we fail to
- * configure that, then we use the MPS tables.
- */
-void __init
-config_acpi_tables(void)
-{
-       memset(&acpi_boot_ops, 0, sizeof(acpi_boot_ops));
-       acpi_boot_ops[ACPI_APIC] = acpi_parse_madt;
-
-       if (!opt_noacpi && !acpi_tables_init()) {
-               have_acpi_tables = 1;
-               printk("Enabling the CPU's according to the ACPI table\n");
-       }
-}
-
-#endif /* CONFIG_X86_IO_APIC */
diff --git a/xen/arch/i386/acpitable.h b/xen/arch/i386/acpitable.h
deleted file mode 100644 (file)
index ddf1c84..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- *  acpitable.c - IA32-specific ACPI boot-time initialization (Revision: 1)
- *
- *  Copyright (C) 1999 Andrew Henroid
- *  Copyright (C) 2001 Richard Schaal
- *  Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
- *  Copyright (C) 2001 Jun Nakajima <jun.nakajima@intel.com>
- *  Copyright (C) 2001 Arjan van de Ven <arjanv@redhat.com>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * $Id: acpitable.h,v 1.3 2001/11/03 22:41:34 fenrus Exp $
- */
-
-/*
- * The following codes are cut&pasted from drivers/acpi. Part of the code
- * there can be not updated or delivered yet.
- * To avoid conflicts when CONFIG_ACPI is defined, the following codes are
- * modified so that they are self-contained in this file.
- * -- jun
- */
-#ifndef _HEADER_ACPITABLE_H_
-#define _HEADER_ACPITABLE_H_
-
-#define dprintk printk
-typedef unsigned int ACPI_TBLPTR;
-
-typedef struct {               /* ACPI common table header */
-       char signature[4];      /* identifies type of table */
-       u32 length;             /* length of table,
-                                  in bytes, * including header */
-       u8 revision;            /* specification minor version # */
-       u8 checksum;            /* to make sum of entire table == 0 */
-       char oem_id[6];         /* OEM identification */
-       char oem_table_id[8];   /* OEM table identification */
-       u32 oem_revision;       /* OEM revision number */
-       char asl_compiler_id[4];        /* ASL compiler vendor ID */
-       u32 asl_compiler_revision;      /* ASL compiler revision number */
-} acpi_table_header __attribute__ ((packed));;
-
-enum {
-       ACPI_APIC = 0,
-       ACPI_BOOT,
-       ACPI_DBGP,
-       ACPI_DSDT,
-       ACPI_ECDT,
-       ACPI_ETDT,
-       ACPI_FACP,
-       ACPI_FACS,
-       ACPI_OEMX,
-       ACPI_PSDT,
-       ACPI_SBST,
-       ACPI_SLIT,
-       ACPI_SPCR,
-       ACPI_SRAT,
-       ACPI_SSDT,
-       ACPI_SPMI,
-       ACPI_XSDT,
-       ACPI_TABLE_COUNT
-};
-
-static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
-       "APIC",
-       "BOOT",
-       "DBGP",
-       "DSDT",
-       "ECDT",
-       "ETDT",
-       "FACP",
-       "FACS",
-       "OEM",
-       "PSDT",
-       "SBST",
-       "SLIT",
-       "SPCR",
-       "SRAT",
-       "SSDT",
-       "SPMI",
-       "XSDT"
-};
-
-struct acpi_table_madt {
-       acpi_table_header header;
-       u32 lapic_address;
-       struct {
-               u32 pcat_compat:1;
-               u32 reserved:31;
-       } flags __attribute__ ((packed));
-} __attribute__ ((packed));;
-
-enum {
-       ACPI_MADT_LAPIC = 0,
-       ACPI_MADT_IOAPIC,
-       ACPI_MADT_INT_SRC_OVR,
-       ACPI_MADT_NMI_SRC,
-       ACPI_MADT_LAPIC_NMI,
-       ACPI_MADT_LAPIC_ADDR_OVR,
-       ACPI_MADT_IOSAPIC,
-       ACPI_MADT_LSAPIC,
-       ACPI_MADT_PLAT_INT_SRC,
-       ACPI_MADT_ENTRY_COUNT
-};
-
-#define RSDP_SIG                       "RSD PTR "
-#define RSDT_SIG                       "RSDT"
-
-#define ACPI_DEBUG_PRINT(pl)
-
-#define ACPI_MEMORY_MODE                0x01
-#define ACPI_LOGICAL_ADDRESSING         0x00
-#define ACPI_PHYSICAL_ADDRESSING        0x01
-
-#define LO_RSDP_WINDOW_BASE            0       /* Physical Address */
-#define HI_RSDP_WINDOW_BASE            0xE0000 /* Physical Address */
-#define LO_RSDP_WINDOW_SIZE            0x400
-#define HI_RSDP_WINDOW_SIZE            0x20000
-#define RSDP_SCAN_STEP                 16
-#define RSDP_CHECKSUM_LENGTH           20
-
-typedef int (*acpi_table_handler) (acpi_table_header * header, unsigned long);
-
-struct acpi_table_rsdp {
-       char signature[8];
-       u8 checksum;
-       char oem_id[6];
-       u8 revision;
-       u32 rsdt_address;
-} __attribute__ ((packed));
-
-struct acpi_table_rsdt {
-       acpi_table_header header;
-       u32 entry[ACPI_TABLE_COUNT];
-} __attribute__ ((packed));
-
-typedef struct {
-       u8 type;
-       u8 length;
-} acpi_madt_entry_header __attribute__ ((packed));
-
-typedef struct {
-       u16 polarity:2;
-       u16 trigger:2;
-       u16 reserved:12;
-} acpi_madt_int_flags __attribute__ ((packed));
-
-struct acpi_table_lapic {
-       acpi_madt_entry_header header;
-       u8 acpi_id;
-       u8 id;
-       struct {
-               u32 enabled:1;
-               u32 reserved:31;
-       } flags __attribute__ ((packed));
-} __attribute__ ((packed));
-
-struct acpi_table_ioapic {
-       acpi_madt_entry_header header;
-       u8 id;
-       u8 reserved;
-       u32 address;
-       u32 global_irq_base;
-} __attribute__ ((packed));
-
-struct acpi_table_int_src_ovr {
-       acpi_madt_entry_header header;
-       u8 bus;
-       u8 bus_irq;
-       u32 global_irq;
-       acpi_madt_int_flags flags;
-} __attribute__ ((packed));
-
-struct acpi_table_nmi_src {
-       acpi_madt_entry_header header;
-       acpi_madt_int_flags flags;
-       u32 global_irq;
-} __attribute__ ((packed));
-
-struct acpi_table_lapic_nmi {
-       acpi_madt_entry_header header;
-       u8 acpi_id;
-       acpi_madt_int_flags flags;
-       u8 lint;
-} __attribute__ ((packed));
-
-struct acpi_table_lapic_addr_ovr {
-       acpi_madt_entry_header header;
-       u8 reserved[2];
-       u64 address;
-} __attribute__ ((packed));
-
-struct acpi_table_iosapic {
-       acpi_madt_entry_header header;
-       u8 id;
-       u8 reserved;
-       u32 global_irq_base;
-       u64 address;
-} __attribute__ ((packed));
-
-struct acpi_table_lsapic {
-       acpi_madt_entry_header header;
-       u8 acpi_id;
-       u8 id;
-       u8 eid;
-       u8 reserved[3];
-       struct {
-               u32 enabled:1;
-               u32 reserved:31;
-       } flags;
-} __attribute__ ((packed));
-
-struct acpi_table_plat_int_src {
-       acpi_madt_entry_header header;
-       acpi_madt_int_flags flags;
-       u8 type;
-       u8 id;
-       u8 eid;
-       u8 iosapic_vector;
-       u32 global_irq;
-       u32 reserved;
-} __attribute__ ((packed));
-
-/*
- * ACPI Table Descriptor.  One per ACPI table
- */
-typedef struct acpi_table_desc {
-       struct acpi_table_desc *prev;
-       struct acpi_table_desc *next;
-       struct acpi_table_desc *installed_desc;
-       acpi_table_header *pointer;
-       void *base_pointer;
-       u8 *aml_pointer;
-       u64 physical_address;
-       u32 aml_length;
-       u32 length;
-       u32 count;
-       u16 table_id;
-       u8 type;
-       u8 allocation;
-       u8 loaded_into_namespace;
-
-} acpi_table_desc __attribute__ ((packed));;
-
-#endif
index d09f1922f2cd53432241eedbcaf685c0a64be317..c44e4301974e6956f49b265b7cdd7e98aa9f5e13 100644 (file)
@@ -1,23 +1,3 @@
-/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
- ****************************************************************************
- * (C) 2002 - Rolf Neugebauer - Intel Research Cambridge
- ****************************************************************************
- *
- *        File: apic.c
- *      Author: 
- *     Changes: 
- *              
- *        Date: Nov 2002
- * 
- * Environment: Xen Hypervisor
- * Description: programmable APIC timer interface for accurate timers
- *              modified version of Linux' apic.c
- *
- ****************************************************************************
- * $Id: c-insert.c,v 1.7 2002/11/08 16:04:34 rn Exp $
- ****************************************************************************
- */
-
 /*
  *  Local APIC handling, local APIC timers
  *
@@ -28,6 +8,8 @@
  *                  thanks to Eric Gilmore
  *                  and Rolf G. Tews
  *                  for testing these extensively.
+ *     Maciej W. Rozycki       :       Various updates and fixes.
+ *     Mikael Pettersson       :       Power Management for UP-APIC.
  */
 
 
 #include <xen/ac_timer.h>
 #include <xen/perfc.h>
 
-#undef APIC_TIME_TRACE
-#ifdef APIC_TIME_TRACE
-#define TRC(_x) _x
-#else
-#define TRC(_x)
-#endif
-
 
 /* Using APIC to generate smp_local_timer_interrupt? */
 int using_apic_timer = 0;
 
+static int enabled_via_apicbase;
+
 int get_maxlvt(void)
 {
     unsigned int v, ver, maxlvt;
@@ -74,13 +51,21 @@ int get_maxlvt(void)
     return maxlvt;
 }
 
-static void clear_local_APIC(void)
+void clear_local_APIC(void)
 {
     int maxlvt;
     unsigned long v;
 
     maxlvt = get_maxlvt();
 
+    /*
+     * Masking an LVT entry on a P6 can trigger a local APIC error
+     * if the vector is zero. Mask LVTERR first to prevent this.
+     */
+    if (maxlvt >= 3) {
+        v = ERROR_APIC_VECTOR; /* any non-zero vector will do */
+        apic_write_around(APIC_LVTERR, v | APIC_LVT_MASKED);
+    }
     /*
      * Careful: we have to set masks only first to deassert
      * any level-triggered sources.
@@ -91,10 +76,6 @@ static void clear_local_APIC(void)
     apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED);
     v = apic_read(APIC_LVT1);
     apic_write_around(APIC_LVT1, v | APIC_LVT_MASKED);
-    if (maxlvt >= 3) {
-        v = apic_read(APIC_LVTERR);
-        apic_write_around(APIC_LVTERR, v | APIC_LVT_MASKED);
-    }
     if (maxlvt >= 4) {
         v = apic_read(APIC_LVTPC);
         apic_write_around(APIC_LVTPC, v | APIC_LVT_MASKED);
@@ -110,6 +91,12 @@ static void clear_local_APIC(void)
         apic_write_around(APIC_LVTERR, APIC_LVT_MASKED);
     if (maxlvt >= 4)
         apic_write_around(APIC_LVTPC, APIC_LVT_MASKED);
+    v = GET_APIC_VERSION(apic_read(APIC_LVR));
+    if (APIC_INTEGRATED(v)) {  /* !82489DX */
+        if (maxlvt > 3)
+            apic_write(APIC_ESR, 0);
+        apic_read(APIC_ESR);
+    }
 }
 
 void __init connect_bsp_APIC(void)
@@ -157,6 +144,13 @@ void disable_local_APIC(void)
     value = apic_read(APIC_SPIV);
     value &= ~APIC_SPIV_APIC_ENABLED;
     apic_write_around(APIC_SPIV, value);
+
+    if (enabled_via_apicbase) {
+        unsigned int l, h;
+        rdmsr(MSR_IA32_APICBASE, l, h);
+        l &= ~MSR_IA32_APICBASE_ENABLE;
+        wrmsr(MSR_IA32_APICBASE, l, h);
+    }
 }
 
 /*
@@ -222,7 +216,9 @@ int __init verify_local_APIC(void)
 
 void __init sync_Arb_IDs(void)
 {
-    /* Wait for idle. */
+    /*
+     * Wait for idle.
+     */
     apic_wait_icr_idle();
 
     Dprintk("Synchronizing Arb IDs.\n");
@@ -245,6 +241,12 @@ void __init init_bsp_APIC(void)
 {
 }
 
+static unsigned long calculate_ldr(unsigned long old)
+{
+    unsigned long id = 1UL << smp_processor_id();
+    return (old & ~APIC_LDR_MASK)|SET_APIC_LOGICAL_ID(id);
+}
+
 void __init setup_local_APIC (void)
 {
     unsigned long value, ver, maxlvt;
@@ -270,15 +272,13 @@ void __init setup_local_APIC (void)
      * Put the APIC into flat delivery mode.
      * Must be "all ones" explicitly for 82489DX.
      */
-    apic_write_around(APIC_DFR, 0xffffffff);
+    apic_write_around(APIC_DFR, APIC_DFR_FLAT);
 
     /*
      * Set up the logical destination ID.
      */
     value = apic_read(APIC_LDR);
-    value &= ~APIC_LDR_MASK;
-    value |= (1<<(smp_processor_id()+24));
-    apic_write_around(APIC_LDR, value);
+    apic_write_around(APIC_LDR, calculate_ldr(value));
 
     /*
      * Set Task Priority to 'accept all'. We never change this
@@ -380,6 +380,8 @@ static int __init detect_init_APIC (void)
     case X86_VENDOR_AMD:
         if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model > 1)
             break;
+        if (boot_cpu_data.x86 == 15 && cpu_has_apic)
+            break;
         goto no_apic;
     case X86_VENDOR_INTEL:
         if (boot_cpu_data.x86 == 6 ||
@@ -403,6 +405,7 @@ static int __init detect_init_APIC (void)
             l &= ~MSR_IA32_APICBASE_BASE;
             l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE;
             wrmsr(MSR_IA32_APICBASE, l, h);
+            enabled_via_apicbase = 1;
         }
     }
 
@@ -416,6 +419,12 @@ static int __init detect_init_APIC (void)
     set_bit(X86_FEATURE_APIC, &boot_cpu_data.x86_capability);
     mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
     boot_cpu_physical_apicid = 0;
+
+    /* The BIOS may have set up the APIC at some other address */
+    rdmsr(MSR_IA32_APICBASE, l, h);
+    if (l & MSR_IA32_APICBASE_ENABLE)
+        mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
+
        if (nmi_watchdog != NMI_NONE)
                nmi_watchdog = NMI_LOCAL_APIC;
 
index 96c8b9a54e088402a12ef57fce72fe7e4156da8c..74a368d50d41139d9965155a41dd09bfc4e9a500 100644 (file)
@@ -17,6 +17,7 @@
  *                                     thanks to Eric Gilmore
  *                                     and Rolf G. Tews
  *                                     for testing these extensively
+ *     Paul Diefenbaugh        :       Added full ACPI support
  */
 
 #include <xen/config.h>
@@ -125,7 +126,7 @@ static void __init replace_pin_at_irq(unsigned int irq,
                        break;                                          \
                reg = io_apic_read(entry->apic, 0x10 + R + pin*2);      \
                reg ACTION;                                             \
-               io_apic_modify(entry->apic, reg);                       \
+               io_apic_write(entry->apic, 0x10 + R + pin*2, reg);      \
                if (!entry->next)                                       \
                        break;                                          \
                entry = irq_2_pin + entry->next;                        \
@@ -166,6 +167,14 @@ void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
        struct IO_APIC_route_entry entry;
        unsigned long flags;
 
+       /* Check delivery_mode to be sure we're not clearing an SMI pin */
+       spin_lock_irqsave(&ioapic_lock, flags);
+       *(((int*)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
+       *(((int*)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin);
+       spin_unlock_irqrestore(&ioapic_lock, flags);
+       if (entry.delivery_mode == dest_SMI)
+               return;
+
        /*
         * Disable it in the IO-APIC irq-routing table:
         */
@@ -878,6 +887,7 @@ void __init print_IO_APIC(void)
        struct IO_APIC_reg_00 reg_00;
        struct IO_APIC_reg_01 reg_01;
        struct IO_APIC_reg_02 reg_02;
+       struct IO_APIC_reg_03 reg_03;
        unsigned long flags;
 
        printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
@@ -898,13 +908,17 @@ void __init print_IO_APIC(void)
        *(int *)&reg_01 = io_apic_read(apic, 1);
        if (reg_01.version >= 0x10)
                *(int *)&reg_02 = io_apic_read(apic, 2);
+       if (reg_01.version >= 0x20)
+               *(int *)&reg_03 = io_apic_read(apic, 3);
        spin_unlock_irqrestore(&ioapic_lock, flags);
 
        printk("\n");
        printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mpc_apicid);
        printk(KERN_DEBUG ".... register #00: %08X\n", *(int *)&reg_00);
        printk(KERN_DEBUG ".......    : physical APIC id: %02X\n", reg_00.ID);
-       if (reg_00.__reserved_1 || reg_00.__reserved_2)
+       printk(KERN_DEBUG ".......    : Delivery Type: %X\n", reg_00.delivery_type);
+       printk(KERN_DEBUG ".......    : LTS          : %X\n", reg_00.LTS);
+       if (reg_00.__reserved_0 || reg_00.__reserved_1 || reg_00.__reserved_2)
                UNEXPECTED_IO_APIC();
 
        printk(KERN_DEBUG ".... register #01: %08X\n", *(int *)&reg_01);
@@ -1710,15 +1724,184 @@ void __init setup_IO_APIC(void)
        printk("ENABLING IO-APIC IRQs\n");
 
        /*
-        * Set up the IO-APIC IRQ routing table by parsing the MP-BIOS
-        * mptable:
+        * Set up IO-APIC IRQ routing.
         */
-       setup_ioapic_ids_from_mpc();
+       if (!acpi_ioapic)
+               setup_ioapic_ids_from_mpc();
        sync_Arb_IDs();
        setup_IO_APIC_irqs();
        init_IO_APIC_traps();
        check_timer();
-       print_IO_APIC();
+       if (!acpi_ioapic)
+               print_IO_APIC();
 }
 
 #endif /* CONFIG_X86_IO_APIC */
+
+
+
+/* --------------------------------------------------------------------------
+                          ACPI-based IOAPIC Configuration
+   -------------------------------------------------------------------------- */
+
+#ifdef CONFIG_ACPI_BOOT
+
+#define IO_APIC_MAX_ID         15
+
+int __init io_apic_get_unique_id (int ioapic, int apic_id)
+{
+       struct IO_APIC_reg_00 reg_00;
+       static unsigned long apic_id_map = 0;
+       unsigned long flags;
+       int i = 0;
+
+       /*
+        * The P4 platform supports up to 256 APIC IDs on two separate APIC 
+        * buses (one for LAPICs, one for IOAPICs), where predecessors only 
+        * supports up to 16 on one shared APIC bus.
+        * 
+        * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full
+        *      advantage of new APIC bus architecture.
+        */
+
+       if (!apic_id_map)
+               apic_id_map = phys_cpu_present_map;
+
+       spin_lock_irqsave(&ioapic_lock, flags);
+       *(int *)&reg_00 = io_apic_read(ioapic, 0);
+       spin_unlock_irqrestore(&ioapic_lock, flags);
+
+       if (apic_id >= IO_APIC_MAX_ID) {
+               printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying "
+                       "%d\n", ioapic, apic_id, reg_00.ID);
+               apic_id = reg_00.ID;
+       }
+
+       /* XAPICs do not need unique IDs */
+       if (clustered_apic_mode == CLUSTERED_APIC_XAPIC){
+               printk(KERN_INFO "IOAPIC[%d]: Assigned apic_id %d\n", 
+                       ioapic, apic_id);
+               return apic_id;
+       }
+
+       /*
+        * Every APIC in a system must have a unique ID or we get lots of nice 
+        * 'stuck on smp_invalidate_needed IPI wait' messages.
+        */
+       if (apic_id_map & (1 << apic_id)) {
+
+               for (i = 0; i < IO_APIC_MAX_ID; i++) {
+                       if (!(apic_id_map & (1 << i)))
+                               break;
+               }
+
+               if (i == IO_APIC_MAX_ID)
+                       panic("Max apic_id exceeded!\n");
+
+               printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, "
+                       "trying %d\n", ioapic, apic_id, i);
+
+               apic_id = i;
+       } 
+
+       apic_id_map |= (1 << apic_id);
+
+       if (reg_00.ID != apic_id) {
+               reg_00.ID = apic_id;
+
+               spin_lock_irqsave(&ioapic_lock, flags);
+               io_apic_write(ioapic, 0, *(int *)&reg_00);
+               *(int *)&reg_00 = io_apic_read(ioapic, 0);
+               spin_unlock_irqrestore(&ioapic_lock, flags);
+
+               /* Sanity check */
+               if (reg_00.ID != apic_id)
+                       panic("IOAPIC[%d]: Unable change apic_id!\n", ioapic);
+       }
+
+       printk(KERN_INFO "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id);
+
+       return apic_id;
+}
+
+
+int __init io_apic_get_version (int ioapic)
+{
+       struct IO_APIC_reg_01   reg_01;
+       unsigned long flags;
+
+       spin_lock_irqsave(&ioapic_lock, flags);
+       *(int *)&reg_01 = io_apic_read(ioapic, 1);
+       spin_unlock_irqrestore(&ioapic_lock, flags);
+
+       return reg_01.version;
+}
+
+
+int __init io_apic_get_redir_entries (int ioapic)
+{
+       struct IO_APIC_reg_01   reg_01;
+       unsigned long flags;
+
+       spin_lock_irqsave(&ioapic_lock, flags);
+       *(int *)&reg_01 = io_apic_read(ioapic, 1);
+       spin_unlock_irqrestore(&ioapic_lock, flags);
+
+       return reg_01.entries;
+}
+
+
+int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low)
+{
+       struct IO_APIC_route_entry entry;
+       unsigned long flags;
+
+       if (!IO_APIC_IRQ(irq)) {
+               printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0/n", 
+                       ioapic);
+               return -EINVAL;
+       }
+
+       /*
+        * Generate a PCI IRQ routing entry and program the IOAPIC accordingly.
+        * Note that we mask (disable) IRQs now -- these get enabled when the
+        * corresponding device driver registers for this IRQ.
+        */
+
+       memset(&entry,0,sizeof(entry));
+
+       entry.delivery_mode = dest_LowestPrio;
+       entry.dest_mode = INT_DELIVERY_MODE;
+       entry.dest.logical.logical_dest = target_cpus();
+       entry.mask = 1;                                  /* Disabled (masked) */
+       entry.trigger = edge_level;
+       entry.polarity = active_high_low;
+
+       add_pin_to_irq(irq, ioapic, pin);
+
+       entry.vector = assign_irq_vector(irq);
+
+       printk(KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> "
+               "IRQ %d Mode:%i Active:%i)\n", ioapic,
+               mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, edge_level, active_high_low);
+
+       if (edge_level) {
+       irq_desc[irq].handler = &ioapic_level_irq_type;
+       } else {
+               irq_desc[irq].handler = &ioapic_edge_irq_type;
+       }
+
+       set_intr_gate(entry.vector, interrupt[irq]);
+
+       if (!ioapic && (irq < 16))
+               disable_8259A_irq(irq);
+
+       spin_lock_irqsave(&ioapic_lock, flags);
+       io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1));
+       io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0));
+       spin_unlock_irqrestore(&ioapic_lock, flags);
+
+       return 0;
+}
+
+#endif /*CONFIG_ACPI_BOOT*/
index 28892fed29a83ea41949d90d444081fe66b75666..e11e962c9cf532fc1cfd4f71e487ce3869e58612 100644 (file)
@@ -9,20 +9,24 @@
  *             Erich Boleyn    :       MP v1.4 and additional changes.
  *             Alan Cox        :       Added EBDA scanning
  *             Ingo Molnar     :       various cleanups and rewrites
- *     Maciej W. Rozycki       :       Bits for default MP configurations
+ *             Maciej W. Rozycki:      Bits for default MP configurations
+ *             Paul Diefenbaugh:       Added full ACPI support
  */
 
 #include <xen/config.h>
 #include <xen/init.h>
 #include <xen/lib.h>
-#include <asm/io.h>
+#include <xen/kernel.h>
 #include <xen/irq.h>
 #include <xen/smp.h>
+#include <xen/mm.h>
+#include <xen/acpi.h>
+#include <asm/acpi.h>
+#include <asm/io.h>
 #include <asm/apic.h>
 #include <asm/mpspec.h>
 #include <asm/pgalloc.h>
 #include <asm/smpboot.h>
-#include <xen/kernel.h>
 
 int numnodes = 1; /* XXX Xen */
 
@@ -124,6 +128,8 @@ static char __init *mpc_family(int family,int model)
                case 0x0F:
                        if (model == 0x00)
                                return("Pentium 4(tm)");
+                       if (model == 0x01)
+                               return("Pentium 4(tm)");
                        if (model == 0x02)
                                return("Pentium 4(tm) XEON(tm)");
                        if (model == 0x0F)
@@ -133,13 +139,6 @@ static char __init *mpc_family(int family,int model)
        return n;
 }
 
-#ifdef CONFIG_X86_IO_APIC
-// XXX Xen extern int have_acpi_tables;        /* set by acpitable.c */
-#define have_acpi_tables (0)
-#else
-#define have_acpi_tables (0)
-#endif
-
 /* 
  * Have to match translation table entries to main table entries by counter
  * hence the mpc_record variable .... can't see a less disgusting way of
@@ -228,6 +227,11 @@ void __init MP_processor_info (struct mpc_config_processor *m)
                boot_cpu_logical_apicid = logical_apicid;
        }
 
+       if (num_processors >= NR_CPUS){
+               printk(KERN_WARNING "NR_CPUS limit of %i reached. Cannot "
+                       "boot CPU(apicid 0x%x).\n", NR_CPUS, m->mpc_apicid);
+               return;
+       }
        num_processors++;
 
        if (m->mpc_apicid > MAX_APICS) {
@@ -444,10 +448,11 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
        
        printk("APIC at: 0x%lX\n",mpc->mpc_lapic);
 
-       /* save the local APIC address, it might be non-default,
-        * but only if we're not using the ACPI tables
+       /* 
+        * Save the local APIC address (it might be non-default) -- but only
+        * if we're not using ACPI.
         */
-       if (!have_acpi_tables)
+       if (!acpi_lapic)
                mp_lapic_addr = mpc->mpc_lapic;
 
        if ((clustered_apic_mode == CLUSTERED_APIC_NUMAQ) && mpc->mpc_oemptr) {
@@ -504,14 +509,7 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
        
        count = (max_mp_busses * sizeof(int)) * 4;
        count += (max_irq_sources * sizeof(struct mpc_config_intsrc));
-       
-       {
-       //bus_data = alloc_bootmem(count);  XXX Xen
-       static char arr[4096];
-       if(count > 4096) BUG();
-       bus_data = (void*)arr;
-       
-       }
+       bus_data = (void *)__get_free_pages(GFP_KERNEL, get_order(count));
        if (!bus_data) {
                printk(KERN_ERR "SMP mptable: out of memory!\n");
                return 0;
@@ -521,7 +519,7 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
        mp_bus_id_to_local = (int *)&bus_data[(max_mp_busses * sizeof(int)) * 2];
        mp_bus_id_to_pci_bus = (int *)&bus_data[(max_mp_busses * sizeof(int)) * 3];
        mp_irqs = (struct mpc_config_intsrc *)&bus_data[(max_mp_busses * sizeof(int)) * 4];
-       memset(mp_bus_id_to_pci_bus, -1, max_mp_busses);
+       memset(mp_bus_id_to_pci_bus, -1, max_mp_busses * sizeof(int));
 
        /*
         *      Now process the configuration blocks.
@@ -534,9 +532,8 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
                        {
                                struct mpc_config_processor *m=
                                        (struct mpc_config_processor *)mpt;
-
-                               /* ACPI may already have provided this one for us */
-                               if (!have_acpi_tables)
+                               /* ACPI may have already provided this data */
+                               if (!acpi_lapic)
                                        MP_processor_info(m);
                                mpt += sizeof(*m);
                                count += sizeof(*m);
@@ -689,6 +686,24 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
        struct mpc_config_lintsrc lintsrc;
        int linttypes[2] = { mp_ExtINT, mp_NMI };
        int i;
+       struct {
+               int mp_bus_id_to_type[MAX_MP_BUSSES];
+               int mp_bus_id_to_node[MAX_MP_BUSSES];
+               int mp_bus_id_to_local[MAX_MP_BUSSES];
+               int mp_bus_id_to_pci_bus[MAX_MP_BUSSES];
+               struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
+       } *bus_data;
+
+       bus_data = (void *)__get_free_pages(GFP_KERNEL, get_order(sizeof(*bus_data)));
+       if (!bus_data)
+               panic("SMP mptable: out of memory!\n");
+       mp_bus_id_to_type = bus_data->mp_bus_id_to_type;
+       mp_bus_id_to_node = bus_data->mp_bus_id_to_node;
+       mp_bus_id_to_local = bus_data->mp_bus_id_to_local;
+       mp_bus_id_to_pci_bus = bus_data->mp_bus_id_to_pci_bus;
+       mp_irqs = bus_data->mp_irqs;
+       for (i = 0; i < MAX_MP_BUSSES; ++i)
+               mp_bus_id_to_pci_bus[i] = -1;
 
        /*
         * local APIC has default address
@@ -765,7 +780,6 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type)
 }
 
 static struct intel_mp_floating *mpf_found;
-extern void    config_acpi_tables(void);
 
 /*
  * Scan the memory blocks for an SMP configuration block.
@@ -774,17 +788,19 @@ void __init get_smp_config (void)
 {
        struct intel_mp_floating *mpf = mpf_found;
 
-#ifdef CONFIG_X86_IO_APIC
        /*
-        * Check if the ACPI tables are provided. Use them only to get
-        * the processor information, mainly because it provides
-        * the info on the logical processor(s), rather than the physical
-        * processor(s) that are provided by the MPS. We attempt to 
-        * check only if the user provided a commandline override
+        * ACPI may be used to obtain the entire SMP configuration or just to 
+        * enumerate/configure processors (CONFIG_ACPI_HT_ONLY).  Note that 
+        * ACPI supports both logical (e.g. Hyper-Threading) and physical 
+        * processors, where MPS only supports physical.
         */
-        config_acpi_tables();
-#endif
-       
+       if (acpi_lapic && acpi_ioapic) {
+               printk(KERN_INFO "Using ACPI (MADT) for SMP configuration information\n");
+               return;
+       }
+       else if (acpi_lapic)
+               printk(KERN_INFO "Using ACPI for processor (LAPIC) configuration information\n");
+
        printk("Intel MultiProcessor Specification v1.%d\n", mpf->mpf_specification);
        if (mpf->mpf_feature2 & (1<<7)) {
                printk("    IMCR and PIC compatibility mode.\n");
@@ -943,3 +959,423 @@ void __init find_smp_config (void)
 #endif
 }
 
+
+/* --------------------------------------------------------------------------
+                            ACPI-based MP Configuration
+   -------------------------------------------------------------------------- */
+
+#ifdef CONFIG_ACPI_BOOT
+
+void __init mp_register_lapic_address (
+       u64                     address)
+{
+       mp_lapic_addr = (unsigned long) address;
+
+       set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
+
+       if (boot_cpu_physical_apicid == -1U)
+               boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
+
+       Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid);
+}
+
+
+void __init mp_register_lapic (
+       u8                      id, 
+       u8                      enabled)
+{
+       struct mpc_config_processor processor;
+       int                     boot_cpu = 0;
+       
+       if (id >= MAX_APICS) {
+               printk(KERN_WARNING "Processor #%d invalid (max %d)\n",
+                       id, MAX_APICS);
+               return;
+       }
+
+       if (id == boot_cpu_physical_apicid)
+               boot_cpu = 1;
+
+       processor.mpc_type = MP_PROCESSOR;
+       processor.mpc_apicid = id;
+
+       /*
+        * mp_register_lapic_address() which is called before the
+        * current function does the fixmap of FIX_APIC_BASE.
+        * Read in the correct APIC version from there
+        */
+       processor.mpc_apicver = apic_read(APIC_LVR);
+
+       processor.mpc_cpuflag = (enabled ? CPU_ENABLED : 0);
+       processor.mpc_cpuflag |= (boot_cpu ? CPU_BOOTPROCESSOR : 0);
+       processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | 
+               (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask;
+       processor.mpc_featureflag = boot_cpu_data.x86_capability[0];
+       processor.mpc_reserved[0] = 0;
+       processor.mpc_reserved[1] = 0;
+
+       MP_processor_info(&processor);
+}
+
+#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
+
+#define MP_ISA_BUS             0
+#define MP_MAX_IOAPIC_PIN      127
+
+struct mp_ioapic_routing {
+       int                     apic_id;
+       int                     irq_start;
+       int                     irq_end;
+       u32                     pin_programmed[4];
+} mp_ioapic_routing[MAX_IO_APICS];
+
+
+static int __init mp_find_ioapic (
+       int                     irq)
+{
+       int                     i = 0;
+
+       /* Find the IOAPIC that manages this IRQ. */
+       for (i = 0; i < nr_ioapics; i++) {
+               if ((irq >= mp_ioapic_routing[i].irq_start)
+                       && (irq <= mp_ioapic_routing[i].irq_end))
+                       return i;
+       }
+
+       printk(KERN_ERR "ERROR: Unable to locate IOAPIC for IRQ %d\n", irq);
+
+       return -1;
+}
+       
+
+void __init mp_register_ioapic (
+       u8                      id, 
+       u32                     address,
+       u32                     irq_base)
+{
+       int                     idx = 0;
+
+       if (nr_ioapics >= MAX_IO_APICS) {
+               printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
+                       "(found %d)\n", MAX_IO_APICS, nr_ioapics);
+               panic("Recompile kernel with bigger MAX_IO_APICS!\n");
+       }
+       if (!address) {
+               printk(KERN_ERR "WARNING: Bogus (zero) I/O APIC address"
+                       " found in MADT table, skipping!\n");
+               return;
+       }
+
+       idx = nr_ioapics++;
+
+       mp_ioapics[idx].mpc_type = MP_IOAPIC;
+       mp_ioapics[idx].mpc_flags = MPC_APIC_USABLE;
+       mp_ioapics[idx].mpc_apicaddr = address;
+
+       set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
+       mp_ioapics[idx].mpc_apicid = io_apic_get_unique_id(idx, id);
+       mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx);
+       
+       /* 
+        * Build basic IRQ lookup table to facilitate irq->io_apic lookups
+        * and to prevent reprogramming of IOAPIC pins (PCI IRQs).
+        */
+       mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].mpc_apicid;
+       mp_ioapic_routing[idx].irq_start = irq_base;
+       mp_ioapic_routing[idx].irq_end = irq_base + 
+               io_apic_get_redir_entries(idx);
+
+       printk("IOAPIC[%d]: apic_id %d, version %d, address 0x%lx, "
+               "IRQ %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, 
+               mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr,
+               mp_ioapic_routing[idx].irq_start,
+               mp_ioapic_routing[idx].irq_end);
+
+       return;
+}
+
+
+void __init mp_override_legacy_irq (
+       u8                      bus_irq,
+       u8                      polarity, 
+       u8                      trigger, 
+       u32                     global_irq)
+{
+       struct mpc_config_intsrc intsrc;
+       int                     i = 0;
+       int                     found = 0;
+       int                     ioapic = -1;
+       int                     pin = -1;
+
+       /* 
+        * Convert 'global_irq' to 'ioapic.pin'.
+        */
+       ioapic = mp_find_ioapic(global_irq);
+       if (ioapic < 0)
+               return;
+       pin = global_irq - mp_ioapic_routing[ioapic].irq_start;
+
+       /*
+        * TBD: This check is for faulty timer entries, where the override
+        *      erroneously sets the trigger to level, resulting in a HUGE 
+        *      increase of timer interrupts!
+        */
+       if ((bus_irq == 0) && (global_irq == 2) && (trigger == 3))
+               trigger = 1;
+
+       intsrc.mpc_type = MP_INTSRC;
+       intsrc.mpc_irqtype = mp_INT;
+       intsrc.mpc_irqflag = (trigger << 2) | polarity;
+       intsrc.mpc_srcbus = MP_ISA_BUS;
+       intsrc.mpc_srcbusirq = bus_irq;                                /* IRQ */
+       intsrc.mpc_dstapic = mp_ioapics[ioapic].mpc_apicid;        /* APIC ID */
+       intsrc.mpc_dstirq = pin;                                    /* INTIN# */
+
+       Dprintk("Int: type %d, pol %d, trig %d, bus %d, irq %d, %d-%d\n",
+               intsrc.mpc_irqtype, intsrc.mpc_irqflag & 3, 
+               (intsrc.mpc_irqflag >> 2) & 3, intsrc.mpc_srcbus, 
+               intsrc.mpc_srcbusirq, intsrc.mpc_dstapic, intsrc.mpc_dstirq);
+
+       /* 
+        * If an existing [IOAPIC.PIN -> IRQ] routing entry exists we override it.
+        * Otherwise create a new entry (e.g. global_irq == 2).
+        */
+       for (i = 0; i < mp_irq_entries; i++) {
+               if ((mp_irqs[i].mpc_dstapic == intsrc.mpc_dstapic) 
+                       && (mp_irqs[i].mpc_srcbusirq == intsrc.mpc_srcbusirq)) {
+                       mp_irqs[i] = intsrc;
+                       found = 1;
+                       break;
+               }
+       }
+       if (!found) {
+               mp_irqs[mp_irq_entries] = intsrc;
+               if (++mp_irq_entries == MAX_IRQ_SOURCES)
+                       panic("Max # of irq sources exceeded!\n");
+       }
+
+       return;
+}
+
+
+void __init mp_config_acpi_legacy_irqs (void)
+{
+       int                     i = 0;
+       int                     ioapic = -1;
+
+       /*
+        * Initialize mp_irqs for IRQ configuration.
+        */
+       unsigned char *bus_data;
+       int count;
+
+       count = (MAX_MP_BUSSES * sizeof(int)) * 4;
+       count += (MAX_IRQ_SOURCES * sizeof(int)) * 4;
+       bus_data = (void *)__get_free_pages(GFP_KERNEL, get_order(count));
+       if (!bus_data) {
+               panic("Fatal: can't allocate bus memory for ACPI legacy IRQ!");
+       }
+       mp_bus_id_to_type = (int *)&bus_data[0];
+       mp_bus_id_to_node = (int *)&bus_data[(MAX_MP_BUSSES * sizeof(int))];
+       mp_bus_id_to_local = (int *)&bus_data[(MAX_MP_BUSSES * sizeof(int)) * 2];
+       mp_bus_id_to_pci_bus = (int *)&bus_data[(MAX_MP_BUSSES * sizeof(int)) * 3];
+       mp_irqs = (struct mpc_config_intsrc *)&bus_data[(MAX_MP_BUSSES * sizeof(int)) * 4];
+       for (i = 0; i < MAX_MP_BUSSES; ++i)
+         mp_bus_id_to_pci_bus[i] = -1;
+
+       /* 
+        * Fabricate the legacy ISA bus (bus #31).
+        */
+       mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA;
+       Dprintk("Bus #%d is ISA\n", MP_ISA_BUS);
+
+       /* 
+        * Locate the IOAPIC that manages the ISA IRQs (0-15). 
+        */
+       ioapic = mp_find_ioapic(0);
+       if (ioapic < 0)
+               return;
+
+       /* 
+        * Use the default configuration for the IRQs 0-15.  These may be
+        * overriden by (MADT) interrupt source override entries.
+        */
+       for (i = 0; i < 16; i++) {
+
+               if (i == 2) continue;                   /* Don't connect IRQ2 */
+
+               mp_irqs[mp_irq_entries].mpc_type = MP_INTSRC;
+               mp_irqs[mp_irq_entries].mpc_irqflag = 0;        /* Conforming */
+               mp_irqs[mp_irq_entries].mpc_srcbus = MP_ISA_BUS;
+               mp_irqs[mp_irq_entries].mpc_dstapic = mp_ioapics[ioapic].mpc_apicid;
+               mp_irqs[mp_irq_entries].mpc_irqtype = i ? mp_INT : mp_ExtINT;   /* 8259A to #0 */
+               mp_irqs[mp_irq_entries].mpc_srcbusirq = i;         /* Identity mapped */
+               mp_irqs[mp_irq_entries].mpc_dstirq = i;
+
+               Dprintk("Int: type %d, pol %d, trig %d, bus %d, irq %d, "
+                       "%d-%d\n", 
+                       mp_irqs[mp_irq_entries].mpc_irqtype, 
+                       mp_irqs[mp_irq_entries].mpc_irqflag & 3, 
+                       (mp_irqs[mp_irq_entries].mpc_irqflag >> 2) & 3, 
+                       mp_irqs[mp_irq_entries].mpc_srcbus, 
+                       mp_irqs[mp_irq_entries].mpc_srcbusirq, 
+                       mp_irqs[mp_irq_entries].mpc_dstapic, 
+                       mp_irqs[mp_irq_entries].mpc_dstirq);
+
+               if (++mp_irq_entries == MAX_IRQ_SOURCES)
+                       panic("Max # of irq sources exceeded!\n");
+       }
+}
+
+/*extern FADT_DESCRIPTOR acpi_fadt;*/
+
+void __init mp_config_ioapic_for_sci(int irq)
+{
+       int ioapic;
+       int ioapic_pin;
+       struct acpi_table_madt* madt;
+       struct acpi_table_int_src_ovr *entry = NULL;
+       acpi_interrupt_flags flags;
+       void *madt_end;
+       acpi_status status;
+
+       /*
+        * Ensure that if there is an interrupt source override entry
+        * for the ACPI SCI, we leave it as is. Unfortunately this involves
+        * walking the MADT again.
+        */
+       status = acpi_get_firmware_table("APIC", 1, ACPI_LOGICAL_ADDRESSING,
+               (struct acpi_table_header **) &madt);
+       if (ACPI_SUCCESS(status)) {
+               madt_end = (void *) (unsigned long)madt + madt->header.length;
+
+               entry = (struct acpi_table_int_src_ovr *)
+                ((unsigned long) madt + sizeof(struct acpi_table_madt));
+
+               while ((void *) entry < madt_end) {
+                       if (entry->header.type == ACPI_MADT_INT_SRC_OVR &&
+                           acpi_fadt.sci_int == entry->bus_irq)
+                               goto found;
+                       
+                       entry = (struct acpi_table_int_src_ovr *)
+                               ((unsigned long) entry + entry->header.length);
+               }
+       }
+       /*
+        * Although the ACPI spec says that the SCI should be level/low
+        * don't reprogram it unless there is an explicit MADT OVR entry
+        * instructing us to do so -- otherwise we break Tyan boards which
+        * have the SCI wired edge/high but no MADT OVR.
+        */
+       return;
+
+found:
+       /*
+        * See the note at the end of ACPI 2.0b section
+        * 5.2.10.8 for what this is about.
+        */
+       flags = entry->flags;
+       acpi_fadt.sci_int = entry->global_irq;
+       irq = entry->global_irq;
+       
+       ioapic = mp_find_ioapic(irq);
+
+       ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start;
+
+       /*
+        * MPS INTI flags:
+        *  trigger: 0=default, 1=edge, 3=level
+        *  polarity: 0=default, 1=high, 3=low
+        * Per ACPI spec, default for SCI means level/low.
+        */
+       io_apic_set_pci_routing(ioapic, ioapic_pin, irq, 
+               (flags.trigger == 1 ? 0 : 1), (flags.polarity == 1 ? 0 : 1));
+}
+
+
+#ifdef CONFIG_ACPI_PCI
+
+void __init mp_parse_prt (void)
+{
+       struct list_head        *node = NULL;
+       struct acpi_prt_entry   *entry = NULL;
+       int                     ioapic = -1;
+       int                     ioapic_pin = 0;
+       int                     irq = 0;
+       int                     idx, bit = 0;
+       int                     edge_level = 0;
+       int                     active_high_low = 0;
+
+       /*
+        * Parsing through the PCI Interrupt Routing Table (PRT) and program
+        * routing for all entries.
+        */
+       list_for_each(node, &acpi_prt.entries) {
+               entry = list_entry(node, struct acpi_prt_entry, node);
+
+               /* Need to get irq for dynamic entry */
+               if (entry->link.handle) {
+                       irq = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, &edge_level, &active_high_low);
+                       if (!irq)
+                               continue;
+               }
+               else {
+                       /* Hardwired IRQ. Assume PCI standard settings */
+                       irq = entry->link.index;
+                       edge_level = 1;
+                       active_high_low = 1;
+               }
+
+               /* Don't set up the ACPI SCI because it's already set up */
+                if (acpi_fadt.sci_int == irq) {
+                        entry->irq = irq; /*we still need to set entry's irq*/
+                       continue;
+                }
+       
+               ioapic = mp_find_ioapic(irq);
+               if (ioapic < 0)
+                       continue;
+               ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start;
+
+               /* 
+                * Avoid pin reprogramming.  PRTs typically include entries  
+                * with redundant pin->irq mappings (but unique PCI devices);
+                * we only only program the IOAPIC on the first.
+                */
+               bit = ioapic_pin % 32;
+               idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32);
+               if (idx > 3) {
+                       printk(KERN_ERR "Invalid reference to IOAPIC pin "
+                               "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, 
+                               ioapic_pin);
+                       continue;
+               }
+               if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) {
+                       printk(KERN_DEBUG "Pin %d-%d already programmed\n",
+                               mp_ioapic_routing[ioapic].apic_id, ioapic_pin);
+                       entry->irq = irq;
+                       continue;
+               }
+
+               mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);
+
+               if (!io_apic_set_pci_routing(ioapic, ioapic_pin, irq, edge_level, active_high_low))
+                       entry->irq = irq;
+
+               printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n",
+                       entry->id.segment, entry->id.bus, 
+                       entry->id.device, ('A' + entry->pin), 
+                       mp_ioapic_routing[ioapic].apic_id, ioapic_pin, 
+                       entry->irq);
+       }
+       
+       print_IO_APIC();
+
+       return;
+}
+
+#endif /*CONFIG_ACPI_PCI*/
+
+#endif /*CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER*/
+
+#endif /*CONFIG_ACPI*/
index 5b0d6a0b9ec5f72ccf1fdbd3f807b6744c29f3cb..6a5f672c485ab7af2edea336ffc5cad8cb62dfe8 100644 (file)
@@ -295,6 +295,17 @@ static void __init pcibios_assign_resources(void)
        }
 }
 
+void __init pcibios_set_cacheline_size(void)
+{
+       struct cpuinfo_x86 *c = &boot_cpu_data;
+
+       pci_cache_line_size = 32 >> 2;
+       if (c->x86 >= 6 && c->x86_vendor == X86_VENDOR_AMD)
+               pci_cache_line_size = 64 >> 2;  /* K7 & K8 */
+       else if (c->x86 > 6 && c->x86_vendor == X86_VENDOR_INTEL)
+               pci_cache_line_size = 128 >> 2; /* P4 */
+}
+
 void __init pcibios_resource_survey(void)
 {
        DBG("PCI: Allocating resources\n");
index 2d051c51b2ab97f1211813552e7af361b049a338..fe70b10166a2ed552072714b3036434ab2090870 100644 (file)
@@ -27,8 +27,10 @@ extern unsigned int pci_probe;
 /* pci-i386.c */
 
 extern unsigned int pcibios_max_latency;
+extern u8 pci_cache_line_size;
 
 void pcibios_resource_survey(void);
+void pcibios_set_cacheline_size(void);
 int pcibios_enable_resources(struct pci_dev *, int);
 
 /* pci-pc.c */
index a907125f75542e83ab4d9800d50b248c4e350379..87e93f12d17a648aa785152fbcff1384bd36fd66 100644 (file)
@@ -6,15 +6,15 @@
 
 #include <xen/config.h>
 #include <xen/types.h>
+#include <xen/kernel.h>
 #include <xen/pci.h>
 #include <xen/init.h>
 #include <xen/slab.h>
 #include <xen/interrupt.h>
 #include <xen/irq.h>
-#include <xen/sched.h>
+
 #include <asm/io.h>
 #include <asm/smp.h>
-#include <asm/mpspec.h>
 #include <asm/io_apic.h>
 
 #include "pci-i386.h"
@@ -45,6 +45,11 @@ struct irq_router {
        int (*set)(struct pci_dev *router, struct pci_dev *dev, int pirq, int new);
 };
 
+struct irq_router_handler {
+       u16 vendor;
+       int (*probe)(struct irq_router *r, struct pci_dev *router, u16 device);
+};
+
 /*
  *  Search 0xf0000 -- 0xfffff for the PCI IRQ Routing Table.
  */
@@ -115,7 +120,7 @@ static void __init pirq_peer_trick(void)
  *  Code for querying and setting of IRQ routes on various interrupt routers.
  */
 
-static void eisa_set_level_irq(unsigned int irq)
+void eisa_set_level_irq(unsigned int irq)
 {
        unsigned char mask = 1 << (irq & 7);
        unsigned int port = 0x4d0 + (irq >> 3);
@@ -195,15 +200,16 @@ static int pirq_piix_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
 /*
  * The VIA pirq rules are nibble-based, like ALI,
  * but without the ugly irq number munging.
+ * However, PIRQD is in the upper instead of lower nibble.
  */
 static int pirq_via_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
 {
-       return read_config_nybble(router, 0x55, pirq);
+       return read_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq);
 }
 
 static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
 {
-       write_config_nybble(router, 0x55, pirq, irq);
+       write_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq, irq);
        return 1;
 }
 
@@ -255,111 +261,221 @@ static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
 }
 
 /*
- *     PIRQ routing for SiS 85C503 router used in several SiS chipsets
- *     According to the SiS 5595 datasheet (preliminary V1.0, 12/24/1997)
- *     the related registers work as follows:
- *     
- *     general: one byte per re-routable IRQ,
+ *     PIRQ routing for SiS 85C503 router used in several SiS chipsets.
+ *     We have to deal with the following issues here:
+ *     - vendors have different ideas about the meaning of link values
+ *     - some onboard devices (integrated in the chipset) have special
+ *       links and are thus routed differently (i.e. not via PCI INTA-INTD)
+ *     - different revision of the router have a different layout for
+ *       the routing registers, particularly for the onchip devices
+ *
+ *     For all routing registers the common thing is we have one byte
+ *     per routeable link which is defined as:
  *              bit 7      IRQ mapping enabled (0) or disabled (1)
- *              bits [6:4] reserved
+ *              bits [6:4] reserved (sometimes used for onchip devices)
  *              bits [3:0] IRQ to map to
  *                  allowed: 3-7, 9-12, 14-15
  *                  reserved: 0, 1, 2, 8, 13
  *
- *     individual registers in device config space:
+ *     The config-space registers located at 0x41/0x42/0x43/0x44 are
+ *     always used to route the normal PCI INT A/B/C/D respectively.
+ *     Apparently there are systems implementing PCI routing table using
+ *     link values 0x01-0x04 and others using 0x41-0x44 for PCI INTA..D.
+ *     We try our best to handle both link mappings.
+ *     
+ *     Currently (2003-05-21) it appears most SiS chipsets follow the
+ *     definition of routing registers from the SiS-5595 southbridge.
+ *     According to the SiS 5595 datasheets the revision id's of the
+ *     router (ISA-bridge) should be 0x01 or 0xb0.
+ *
+ *     Furthermore we've also seen lspci dumps with revision 0x00 and 0xb1.
+ *     Looks like these are used in a number of SiS 5xx/6xx/7xx chipsets.
+ *     They seem to work with the current routing code. However there is
+ *     some concern because of the two USB-OHCI HCs (original SiS 5595
+ *     had only one). YMMV.
  *
- *     0x41/0x42/0x43/0x44:    PCI INT A/B/C/D - bits as in general case
+ *     Onchip routing for router rev-id 0x01/0xb0 and probably 0x00/0xb1:
  *
- *     0x61:                   IDEIRQ: bits as in general case - but:
- *                             bits [6:5] must be written 01
- *                             bit 4 channel-select primary (0), secondary (1)
+ *     0x61:   IDEIRQ:
+ *             bits [6:5] must be written 01
+ *             bit 4 channel-select primary (0), secondary (1)
  *
- *     0x62:                   USBIRQ: bits as in general case - but:
- *                             bit 4 OHCI function disabled (0), enabled (1)
+ *     0x62:   USBIRQ:
+ *             bit 6 OHCI function disabled (0), enabled (1)
  *     
- *     0x6a:                   ACPI/SCI IRQ - bits as in general case
+ *     0x6a:   ACPI/SCI IRQ: bits 4-6 reserved
+ *
+ *     0x7e:   Data Acq. Module IRQ - bits 4-6 reserved
+ *
+ *     We support USBIRQ (in addition to INTA-INTD) and keep the
+ *     IDE, ACPI and DAQ routing untouched as set by the BIOS.
+ *
+ *     Currently the only reported exception is the new SiS 65x chipset
+ *     which includes the SiS 69x southbridge. Here we have the 85C503
+ *     router revision 0x04 and there are changes in the register layout
+ *     mostly related to the different USB HCs with USB 2.0 support.
  *
- *     0x7e:                   Data Acq. Module IRQ - bits as in general case
+ *     Onchip routing for router rev-id 0x04 (try-and-error observation)
  *
- *     Apparently there are systems implementing PCI routing table using both
- *     link values 0x01-0x04 and 0x41-0x44 for PCI INTA..D, but register offsets
- *     like 0x62 as link values for USBIRQ e.g. So there is no simple
- *     "register = offset + pirq" relation.
- *     Currently we support PCI INTA..D and USBIRQ and try our best to handle
- *     both link mappings.
- *     IDE/ACPI/DAQ mapping is currently unsupported (left untouched as set by BIOS).
+ *     0x60/0x61/0x62/0x63:    1xEHCI and 3xOHCI (companion) USB-HCs
+ *                             bit 6-4 are probably unused, not like 5595
  */
 
-static int pirq_sis_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
+#define PIRQ_SIS_IRQ_MASK      0x0f
+#define PIRQ_SIS_IRQ_DISABLE   0x80
+#define PIRQ_SIS_USB_ENABLE    0x40
+#define PIRQ_SIS_DETECT_REGISTER 0x40
+
+/* return value:
+ * -1 on error
+ * 0 for PCI INTA-INTD
+ * 0 or enable bit mask to check or set for onchip functions
+ */
+static inline int pirq_sis5595_onchip(int pirq, int *reg)
 {
-       u8 x;
-       int reg = pirq;
+       int ret = -1;
 
+       *reg = pirq;
        switch(pirq) {
-               case 0x01:
-               case 0x02:
-               case 0x03:
-               case 0x04:
-                       reg += 0x40;
-               case 0x41:
-               case 0x42:
-               case 0x43:
-               case 0x44:
-               case 0x62:
-                       pci_read_config_byte(router, reg, &x);
-                       if (reg != 0x62)
-                               break;
-                       if (!(x & 0x40))
-                               return 0;
-                       break;
-               case 0x61:
-               case 0x6a:
-               case 0x7e:
-                       printk(KERN_INFO "SiS pirq: advanced IDE/ACPI/DAQ mapping not yet implemented\n");
-                       return 0;
-               default:                        
-                       printk(KERN_INFO "SiS router pirq escape (%d)\n", pirq);
-                       return 0;
+       case 0x01:
+       case 0x02:
+       case 0x03:
+       case 0x04:
+               *reg += 0x40;
+       case 0x41:
+       case 0x42:
+       case 0x43:
+       case 0x44:
+               ret = 0;
+               break;
+
+       case 0x62:
+               ret = PIRQ_SIS_USB_ENABLE;      /* documented for 5595 */
+               break;
+
+       case 0x61:
+       case 0x6a:
+       case 0x7e:
+               printk(KERN_INFO "SiS pirq: IDE/ACPI/DAQ mapping not implemented: (%u)\n",
+                      (unsigned) pirq);
+               /* fall thru */
+       default:
+               printk(KERN_INFO "SiS router unknown request: (%u)\n",
+                      (unsigned) pirq);
+               break;
        }
-       return (x & 0x80) ? 0 : (x & 0x0f);
-}
+       return ret;
+}              
 
-static int pirq_sis_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
+/* return value:
+ * -1 on error
+ * 0 for PCI INTA-INTD
+ * 0 or enable bit mask to check or set for onchip functions
+ */
+static inline int pirq_sis96x_onchip(int pirq, int *reg)
 {
-       u8 x;
-       int reg = pirq;
+       int ret = -1;
 
+       *reg = pirq;
        switch(pirq) {
-               case 0x01:
-               case 0x02:
-               case 0x03:
-               case 0x04:
-                       reg += 0x40;
-               case 0x41:
-               case 0x42:
-               case 0x43:
-               case 0x44:
-               case 0x62:
-                       x = (irq&0x0f) ? (irq&0x0f) : 0x80;
-                       if (reg != 0x62)
-                               break;
-                       /* always mark OHCI enabled, as nothing else knows about this */
-                       x |= 0x40;
-                       break;
-               case 0x61:
-               case 0x6a:
-               case 0x7e:
-                       printk(KERN_INFO "advanced SiS pirq mapping not yet implemented\n");
-                       return 0;
-               default:                        
-                       printk(KERN_INFO "SiS router pirq escape (%d)\n", pirq);
-                       return 0;
+       case 0x01:
+       case 0x02:
+       case 0x03:
+       case 0x04:
+               *reg += 0x40;
+       case 0x41:
+       case 0x42:
+       case 0x43:
+       case 0x44:
+       case 0x60:
+       case 0x61:
+       case 0x62:
+       case 0x63:
+               ret = 0;
+               break;
+
+       default:
+               printk(KERN_INFO "SiS router unknown request: (%u)\n",
+                      (unsigned) pirq);
+               break;
        }
+       return ret;
+}              
+
+
+static int pirq_sis5595_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
+{
+       u8 x;
+       int reg, check;
+
+       check = pirq_sis5595_onchip(pirq, &reg);
+       if (check < 0)
+               return 0;
+
+       pci_read_config_byte(router, reg, &x);
+       if (check != 0  &&  !(x & check))
+               return 0;
+
+       return (x & PIRQ_SIS_IRQ_DISABLE) ? 0 : (x & PIRQ_SIS_IRQ_MASK);
+}
+
+static int pirq_sis96x_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
+{
+       u8 x;
+       int reg, check;
+
+       check = pirq_sis96x_onchip(pirq, &reg);
+       if (check < 0)
+               return 0;
+
+       pci_read_config_byte(router, reg, &x);
+       if (check != 0  &&  !(x & check))
+               return 0;
+
+       return (x & PIRQ_SIS_IRQ_DISABLE) ? 0 : (x & PIRQ_SIS_IRQ_MASK);
+}
+
+static int pirq_sis5595_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
+{
+       u8 x;
+       int reg, set;
+
+       set = pirq_sis5595_onchip(pirq, &reg);
+       if (set < 0)
+               return 0;
+
+       x = (irq & PIRQ_SIS_IRQ_MASK);
+       if (x == 0)
+               x = PIRQ_SIS_IRQ_DISABLE;
+       else
+               x |= set;
+
        pci_write_config_byte(router, reg, x);
 
        return 1;
 }
 
+static int pirq_sis96x_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
+{
+       u8 x;
+       int reg, set;
+
+       set = pirq_sis96x_onchip(pirq, &reg);
+       if (set < 0)
+               return 0;
+
+       x = (irq & PIRQ_SIS_IRQ_MASK);
+       if (x == 0)
+               x = PIRQ_SIS_IRQ_DISABLE;
+       else
+               x |= set;
+
+       pci_write_config_byte(router, reg, x);
+
+       return 1;
+}
+
+
 /*
  * VLSI: nibble offset 0x74 - educated guess due to routing table and
  *       config space of VLSI 82C534 PCI-bridge/router (1004:0102)
@@ -452,94 +568,264 @@ static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
        return pcibios_set_irq_routing(bridge, pin, irq);
 }
 
-static struct irq_router pirq_bios_router =
-       { "BIOS", 0, 0, NULL, pirq_bios_set };
-
 #endif
 
-static struct irq_router pirq_routers[] = {
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371FB_0, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371SB_0, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371MX,   pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_0, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, pirq_piix_get, pirq_piix_set },
-       { "PIIX", PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, pirq_piix_get, pirq_piix_set },
-
-       { "ALI", PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, pirq_ali_get, pirq_ali_set },
-
-       { "ITE", PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_IT8330G_0, pirq_ite_get, pirq_ite_set },
-
-       { "VIA", PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, pirq_via_get, pirq_via_set },
-       { "VIA", PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C596, pirq_via_get, pirq_via_set },
-       { "VIA", PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, pirq_via_get, pirq_via_set },
-
-       { "OPTI", PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C700, pirq_opti_get, pirq_opti_set },
-
-       { "NatSemi", PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5520, pirq_cyrix_get, pirq_cyrix_set },
-       { "SIS", PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, pirq_sis_get, pirq_sis_set },
-       { "VLSI 82C534", PCI_VENDOR_ID_VLSI, PCI_DEVICE_ID_VLSI_82C534, pirq_vlsi_get, pirq_vlsi_set },
-       { "ServerWorks", PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4,
-         pirq_serverworks_get, pirq_serverworks_set },
-       { "ServerWorks", PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5,
-         pirq_serverworks_get, pirq_serverworks_set },
-       { "AMD756 VIPER", PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_740B,
-               pirq_amd756_get, pirq_amd756_set },
-       { "AMD766", PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7413,
-               pirq_amd756_get, pirq_amd756_set },
-       { "AMD768", PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7443,
-               pirq_amd756_get, pirq_amd756_set },
-
-       { "default", 0, 0, NULL, NULL }
-};
 
-static struct irq_router *pirq_router;
+static __init int intel_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
+{
+       /* We must not touch 440GX even if we have tables. 440GX has
+          different IRQ routing weirdness */
+       if(pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_0, NULL) ||
+          pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_2, NULL))
+               return 0;
+       switch(device)
+       {
+               case PCI_DEVICE_ID_INTEL_82371FB_0:
+               case PCI_DEVICE_ID_INTEL_82371SB_0:
+               case PCI_DEVICE_ID_INTEL_82371AB_0:
+               case PCI_DEVICE_ID_INTEL_82371MX:
+               case PCI_DEVICE_ID_INTEL_82443MX_0:
+               case PCI_DEVICE_ID_INTEL_82801AA_0:
+               case PCI_DEVICE_ID_INTEL_82801AB_0:
+               case PCI_DEVICE_ID_INTEL_82801BA_0:
+               case PCI_DEVICE_ID_INTEL_82801BA_10:
+               case PCI_DEVICE_ID_INTEL_82801CA_0:
+               case PCI_DEVICE_ID_INTEL_82801CA_12:
+               case PCI_DEVICE_ID_INTEL_82801DB_0:
+               case PCI_DEVICE_ID_INTEL_82801E_0:
+               case PCI_DEVICE_ID_INTEL_82801EB_0:
+               case PCI_DEVICE_ID_INTEL_ESB_0:
+                       r->name = "PIIX/ICH";
+                       r->get = pirq_piix_get;
+                       r->set = pirq_piix_set;
+                       return 1;
+       }
+       return 0;
+}
+
+static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
+{
+       /* FIXME: We should move some of the quirk fixup stuff here */
+       switch(device)
+       {
+               case PCI_DEVICE_ID_VIA_82C586_0:
+               case PCI_DEVICE_ID_VIA_82C596:
+               case PCI_DEVICE_ID_VIA_82C686:
+               case PCI_DEVICE_ID_VIA_8231:
+               /* FIXME: add new ones for 8233/5 */
+                       r->name = "VIA";
+                       r->get = pirq_via_get;
+                       r->set = pirq_via_set;
+                       return 1;
+       }
+       return 0;
+}
+
+static __init int vlsi_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
+{
+       switch(device)
+       {
+               case PCI_DEVICE_ID_VLSI_82C534:
+                       r->name = "VLSI 82C534";
+                       r->get = pirq_vlsi_get;
+                       r->set = pirq_vlsi_set;
+                       return 1;
+       }
+       return 0;
+}
+
+
+static __init int serverworks_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
+{
+       switch(device)
+       {
+               case PCI_DEVICE_ID_SERVERWORKS_OSB4:
+               case PCI_DEVICE_ID_SERVERWORKS_CSB5:
+                       r->name = "ServerWorks";
+                       r->get = pirq_serverworks_get;
+                       r->set = pirq_serverworks_set;
+                       return 1;
+       }
+       return 0;
+}
+
+static __init int sis_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
+{
+       u8 reg;
+       u16 devid;
+
+       if (device != PCI_DEVICE_ID_SI_503)
+               return 0;
+               
+       /*
+        * In case of SiS south bridge, we need to detect the two
+        * kinds of routing tables we have seen so far (5595 and 96x). 
+        * Since the maintain the same device ID, we need to do poke 
+        * the PCI configuration space to find the router type we are
+        * dealing with.
+        */
+
+       /*
+        * Factoid: writing bit6 of register 0x40 of the router config space
+        * will make the SB to show up 0x096x inside the device id. Note,
+        * we need to restore register 0x40 after the device id poke.
+        */
+
+       pci_read_config_byte(router, PIRQ_SIS_DETECT_REGISTER, &reg);
+       pci_write_config_byte(router, PIRQ_SIS_DETECT_REGISTER, reg | (1 << 6));
+       pci_read_config_word(router, PCI_DEVICE_ID, &devid);
+       pci_write_config_byte(router, PIRQ_SIS_DETECT_REGISTER, reg);
+
+       if ((devid & 0xfff0) == 0x0960) {
+               r->name = "SIS96x";
+               r->get = pirq_sis96x_get;
+               r->set = pirq_sis96x_set;
+               DBG("PCI: Detecting SiS router at %02x:%02x : SiS096x detected\n",
+                   rt->rtr_bus, rt->rtr_devfn);
+       } else {
+               r->name = "SIS5595";
+               r->get = pirq_sis5595_get;
+               r->set = pirq_sis5595_set;
+               DBG("PCI: Detecting SiS router at %02x:%02x : SiS5595 detected\n",
+                   rt->rtr_bus, rt->rtr_devfn);
+       }
+       return 1;
+}
+
+static __init int cyrix_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
+{
+       switch(device)
+       {
+               case PCI_DEVICE_ID_CYRIX_5520:
+                       r->name = "NatSemi";
+                       r->get = pirq_cyrix_get;
+                       r->set = pirq_cyrix_set;
+                       return 1;
+       }
+       return 0;
+}
+
+static __init int opti_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
+{
+       switch(device)
+       {
+               case PCI_DEVICE_ID_OPTI_82C700:
+                       r->name = "OPTI";
+                       r->get = pirq_opti_get;
+                       r->set = pirq_opti_set;
+                       return 1;
+       }
+       return 0;
+}
+
+static __init int ite_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
+{
+       switch(device)
+       {
+               case PCI_DEVICE_ID_ITE_IT8330G_0:
+                       r->name = "ITE";
+                       r->get = pirq_ite_get;
+                       r->set = pirq_ite_set;
+                       return 1;
+       }
+       return 0;
+}
+
+static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
+{
+       switch(device)
+       {
+               case PCI_DEVICE_ID_AL_M1533:
+                       r->name = "ALI";
+                       r->get = pirq_ali_get;
+                       r->set = pirq_ali_set;
+                       return 1;
+               /* Should add 156x some day */
+       }
+       return 0;
+}
+
+static __init int amd_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
+{
+       switch(device)
+       {
+               case PCI_DEVICE_ID_AMD_VIPER_740B:
+                       r->name = "AMD756";
+                       break;
+               case PCI_DEVICE_ID_AMD_VIPER_7413:
+                       r->name = "AMD766";
+                       break;
+               case PCI_DEVICE_ID_AMD_VIPER_7443:
+                       r->name = "AMD768";
+                       break;
+               default:
+                       return 0;
+       }
+       r->get = pirq_amd756_get;
+       r->set = pirq_amd756_set;
+       return 1;
+}
+               
+static __initdata struct irq_router_handler pirq_routers[] = {
+       { PCI_VENDOR_ID_INTEL, intel_router_probe },
+       { PCI_VENDOR_ID_AL, ali_router_probe },
+       { PCI_VENDOR_ID_ITE, ite_router_probe },
+       { PCI_VENDOR_ID_VIA, via_router_probe },
+       { PCI_VENDOR_ID_OPTI, opti_router_probe },
+       { PCI_VENDOR_ID_SI, sis_router_probe },
+       { PCI_VENDOR_ID_CYRIX, cyrix_router_probe },
+       { PCI_VENDOR_ID_VLSI, vlsi_router_probe },
+       { PCI_VENDOR_ID_SERVERWORKS, serverworks_router_probe },
+       { PCI_VENDOR_ID_AMD, amd_router_probe },
+       /* Someone with docs needs to add the ATI Radeon IGP */
+       { 0, NULL }
+};
+static struct irq_router pirq_router;
 static struct pci_dev *pirq_router_dev;
 
-static void __init pirq_find_router(void)
+/*
+ *     FIXME: should we have an option to say "generic for
+ *     chipset" ?
+ */
+static void __init pirq_find_router(struct irq_router *r)
 {
        struct irq_routing_table *rt = pirq_table;
-       struct irq_router *r;
+       struct irq_router_handler *h;
 
 #ifdef CONFIG_PCI_BIOS
        if (!rt->signature) {
                printk(KERN_INFO "PCI: Using BIOS for IRQ routing\n");
-               pirq_router = &pirq_bios_router;
+               r->set = pirq_bios_set;
+               r->name = "BIOS";
                return;
        }
 #endif
 
+       /* Default unless a driver reloads it */
+       r->name = "default";
+       r->get = NULL;
+       r->set = NULL;
+       
        DBG("PCI: Attempting to find IRQ router for %04x:%04x\n",
            rt->rtr_vendor, rt->rtr_device);
 
-       /* fall back to default router if nothing else found */
-       pirq_router = &pirq_routers[ARRAY_SIZE(pirq_routers) - 1];
-
        pirq_router_dev = pci_find_slot(rt->rtr_bus, rt->rtr_devfn);
        if (!pirq_router_dev) {
                DBG("PCI: Interrupt router not found at %02x:%02x\n", rt->rtr_bus, rt->rtr_devfn);
                return;
        }
 
-       for(r=pirq_routers; r->vendor; r++) {
-               /* Exact match against router table entry? Use it! */
-               if (r->vendor == rt->rtr_vendor && r->device == rt->rtr_device) {
-                       pirq_router = r;
+       for( h = pirq_routers; h->vendor; h++) {
+               /* First look for a router match */
+               if (rt->rtr_vendor == h->vendor && h->probe(r, pirq_router_dev, rt->rtr_device))
+                       break;
+               /* Fall back to a device match */
+               if (pirq_router_dev->vendor == h->vendor && h->probe(r, pirq_router_dev, pirq_router_dev->device))
                        break;
-               }
-               /* Match against router device entry? Use it as a fallback */
-               if (r->vendor == pirq_router_dev->vendor && r->device == pirq_router_dev->device) {
-                       pirq_router = r;
-               }
        }
        printk(KERN_INFO "PCI: Using IRQ router %s [%04x/%04x] at %s\n",
-               pirq_router->name,
+               pirq_router.name,
                pirq_router_dev->vendor,
                pirq_router_dev->device,
                pirq_router_dev->slot_name);
@@ -568,7 +854,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
        int i, pirq, newirq;
        int irq = 0;
        u32 mask;
-       struct irq_router *r = pirq_router;
+       struct irq_router *r = &pirq_router;
        struct pci_dev *dev2;
        char *msg = NULL;
 
@@ -688,7 +974,7 @@ void __init pcibios_irq_init(void)
 #endif
        if (pirq_table) {
                pirq_peer_trick();
-               pirq_find_router();
+               pirq_find_router(&pirq_router);
                if (pirq_table->exclusive_irqs) {
                        int i;
                        for (i=0; i<16; i++)
@@ -779,9 +1065,16 @@ void pcibios_penalize_isa_irq(int irq)
 void pcibios_enable_irq(struct pci_dev *dev)
 {
        u8 pin;
+       extern int interrupt_line_quirk;
+       
        pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
        if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
                char *msg;
+
+               /* With IDE legacy devices the IRQ lookup failure is not a problem.. */
+               if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && !(dev->class & 0x5))
+                       return;
+
                if (io_apic_assign_pci_irqs)
                        msg = " Probably buggy MP table.";
                else if (pci_probe & PCI_BIOS_IRQ_SCAN)
@@ -791,4 +1084,9 @@ void pcibios_enable_irq(struct pci_dev *dev)
                printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device %s.%s\n",
                       'A' + pin - 1, dev->slot_name, msg);
        }
+       /* VIA bridges use interrupt line for apic/pci steering across
+          the V-Link */
+       else if (interrupt_line_quirk)
+               pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
+               
 }
index eae7521c3603185a50605510fac935b271083c7b..e32472c826ffaf5db08e408305d5263799496b23 100644 (file)
@@ -6,11 +6,12 @@
 
 #include <xen/config.h>
 #include <xen/types.h>
-/*#include <xen/kernel.h>*/
+#include <xen/kernel.h>
 #include <xen/sched.h>
 #include <xen/pci.h>
 #include <xen/init.h>
 #include <xen/ioport.h>
+#include <xen/acpi.h>
 
 /*#include <asm/segment.h>*/
 #include <asm/io.h>
@@ -32,6 +33,8 @@ struct pci_ops *pci_root_ops = NULL;
 int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value) = NULL;
 int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value) = NULL;
 
+static int pci_using_acpi_prt = 0;
+
 #ifdef CONFIG_MULTIQUAD
 #define BUS2QUAD(global) (mp_bus_id_to_node[global])
 #define BUS2LOCAL(global) (mp_bus_id_to_local[global])
@@ -442,36 +445,21 @@ static struct pci_ops pci_direct_conf2 = {
 static int __devinit pci_sanity_check(struct pci_ops *o)
 {
        u16 x;
-       struct pci_bus *bus;            /* Fake bus and device */
-       struct pci_dev *dev;
-       int ret = 0;
+       struct pci_bus bus;             /* Fake bus and device */
+       struct pci_dev dev;
 
        if (pci_probe & PCI_NO_CHECKS)
                return 1;
-
-       bus = kmalloc(sizeof(*bus), GFP_KERNEL);
-       dev = kmalloc(sizeof(*dev), GFP_KERNEL);
-       if ( (bus == NULL) || (dev == NULL) )
-               goto out;
-
-       bus->number = 0;
-       dev->bus = bus;
-       for(dev->devfn=0; dev->devfn < 0x100; dev->devfn++)
-               if ((!o->read_word(dev, PCI_CLASS_DEVICE, &x) &&
+       bus.number = 0;
+       dev.bus = &bus;
+       for(dev.devfn=0; dev.devfn < 0x100; dev.devfn++)
+               if ((!o->read_word(&dev, PCI_CLASS_DEVICE, &x) &&
                     (x == PCI_CLASS_BRIDGE_HOST || x == PCI_CLASS_DISPLAY_VGA)) ||
-                   (!o->read_word(dev, PCI_VENDOR_ID, &x) &&
+                   (!o->read_word(&dev, PCI_VENDOR_ID, &x) &&
                     (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ)))
-               {
-                       ret = 1;
-                       break;
-               }
- out:
-       if ( bus != NULL )
-               kfree(bus);
-       if ( dev != NULL)
-               kfree(dev);
+                       return 1;
        DBG("PCI: Sanity check failed\n");
-       return ret;
+       return 0;
 }
 
 static struct pci_ops * __devinit pci_check_direct(void)
@@ -1032,7 +1020,8 @@ struct irq_routing_table * __devinit pcibios_get_irq_routing_table(void)
                "xor %%ah, %%ah\n"
                "1:"
                : "=a" (ret),
-                 "=b" (map)
+                 "=b" (map),
+                 "+m" (opt)
                : "0" (PCIBIOS_GET_ROUTING_OPTIONS),
                  "1" (0),
                  "D" ((long) &opt),
@@ -1372,6 +1361,23 @@ void __devinit  pcibios_fixup_bus(struct pci_bus *b)
        pci_read_bridge_bases(b);
 }
 
+struct pci_bus * __devinit pcibios_scan_root(int busnum)
+{
+       struct list_head *list;
+       struct pci_bus *bus;
+
+       list_for_each(list, &pci_root_buses) {
+               bus = pci_bus_b(list);
+               if (bus->number == busnum) {
+                       /* Already scanned */
+                       return bus;
+               }
+       }
+
+       printk("PCI: Probing PCI hardware (bus %02x)\n", busnum);
+
+       return pci_scan_bus(busnum, pci_root_ops, NULL);
+}
 
 void __devinit pcibios_config_init(void)
 {
@@ -1424,8 +1430,22 @@ void __init pcibios_init(void)
                return;
        }
 
+       pcibios_set_cacheline_size();
+
        printk(KERN_INFO "PCI: Probing PCI hardware\n");
-       pci_root_bus = pci_scan_bus(0, pci_root_ops, NULL);
+#ifdef CONFIG_ACPI_PCI
+       if (!acpi_noirq && !acpi_pci_irq_init()) {
+               pci_using_acpi_prt = 1;
+               printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
+               printk(KERN_INFO "PCI: if you experience problems, try using option 'pci=noacpi' or even 'acpi=off'\n");
+       }
+#endif
+       if (!pci_using_acpi_prt) {
+               pci_root_bus = pcibios_scan_root(0);
+               pcibios_irq_init();
+               pcibios_fixup_peer_bridges();
+               pcibios_fixup_irqs();
+       }
        if (clustered_apic_mode && (numnodes > 1)) {
                for (quad = 1; quad < numnodes; ++quad) {
                        printk("Scanning PCI bus %d for quad %d\n", 
@@ -1435,9 +1455,6 @@ void __init pcibios_init(void)
                }
        }
 
-       pcibios_irq_init();
-       pcibios_fixup_peer_bridges();
-       pcibios_fixup_irqs();
        pcibios_resource_survey();
 
 #ifdef CONFIG_PCI_BIOS
@@ -1489,6 +1506,9 @@ char * __devinit  pcibios_setup(char *str)
        } else if (!strncmp(str, "lastbus=", 8)) {
                pcibios_last_bus = simple_strtol(str+8, NULL, 0);
                return NULL;
+       } else if (!strncmp(str, "noacpi", 6)) {
+               acpi_noirq_set();
+               return NULL;
        }
        return str;
 }
@@ -1504,6 +1524,15 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 
        if ((err = pcibios_enable_resources(dev, mask)) < 0)
                return err;
+
+#ifdef CONFIG_ACPI_PCI
+       if (pci_using_acpi_prt) {
+               acpi_pci_irq_enable(dev);
+               return 0;
+       }
+#endif
+
        pcibios_enable_irq(dev);
+
        return 0;
 }
index f9107df29700b04b4ad06650e047cc2aa06974db..d4b411ea4359321e9f3ad670818a99792e923fca 100644 (file)
@@ -6,6 +6,7 @@
 #include <xen/sched.h>
 #include <xen/pci.h>
 #include <xen/serial.h>
+#include <xen/acpi.h>
 #include <asm/bitops.h>
 #include <asm/smp.h>
 #include <asm/processor.h>
 #include <asm/pdb.h>
 #include <xen/trace.h>
 
-struct cpuinfo_x86 boot_cpu_data = { 0 };
+char ignore_irq13;             /* set if exception 16 works */
+struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
+
 /* Lots of nice things, since we only target PPro+. */
 unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE;
+EXPORT_SYMBOL(mmu_cr4_features);
+
 unsigned long wait_init_idle;
 
 struct task_struct *idle_task[NR_CPUS] = { &idle0_task };
 
+#ifdef CONFIG_ACPI_INTERPRETER
+       int acpi_disabled = 0;
+#else
+       int acpi_disabled = 1;
+#endif
+EXPORT_SYMBOL(acpi_disabled);
+
+#ifdef CONFIG_ACPI_BOOT
+extern int __initdata acpi_ht;
+int acpi_force __initdata = 0;
+#endif
+
 int phys_proc_id[NR_CPUS];
 int logical_proc_id[NR_CPUS];
 
@@ -363,6 +380,8 @@ void __init start_of_day(void)
     }
 #endif
     paging_init();                /* not much here now, but sets up fixmap */
+    if ( !opt_noacpi )
+        acpi_boot_init();
 #ifdef CONFIG_SMP
     if ( smp_found_config ) 
         get_smp_config();
index 5aa8a48247ada6ad5863e1012326f5c9f9c5a126..0d26c89cbbc521a17efc2e603025c44b93017cc0 100644 (file)
@@ -1,6 +1,7 @@
 
 default:
        $(MAKE) -C char
+       $(MAKE) -C acpi
        $(MAKE) -C pci
        if [ "$(nodev)" != "y" ]; then \
        $(MAKE) -C net ; \
@@ -13,6 +14,7 @@ default:
 
 clean:
        $(MAKE) -C char clean
+       $(MAKE) -C acpi clean
        $(MAKE) -C pci clean
        $(MAKE) -C net clean
        $(MAKE) -C block clean
diff --git a/xen/drivers/acpi/Makefile b/xen/drivers/acpi/Makefile
new file mode 100644 (file)
index 0000000..3e10aba
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Makefile for the Linux ACPI interpreter
+# 
+
+include $(BASEDIR)/Rules.mk
+
+OBJS := acpi_ksyms.o tables.o
+
+default: $(OBJS)
+       $(LD) -r -o driver.o $(OBJS)
+
+clean:
+       rm -f *.o *~ core
+
+#export ACPI_CFLAGS
+#
+#ACPI_CFLAGS   := -Os 
+#
+#ifdef CONFIG_ACPI_DEBUG
+#  ACPI_CFLAGS += -DACPI_DEBUG_OUTPUT
+#endif
+#
+#EXTRA_CFLAGS  += $(ACPI_CFLAGS)
+#
+#export-objs   := acpi_ksyms.o processor.o
+#
+#obj-$(CONFIG_ACPI)    := acpi_ksyms.o 
+#
+#
+# ACPI Boot-Time Table Parsing
+#
+#obj-$(CONFIG_ACPI_BOOT)               += tables.o
+#obj-$(CONFIG_ACPI_INTERPRETER)        += blacklist.o
+#
+#
+# ACPI Core Subsystem (Interpreter)
+#
+#ifeq ($(CONFIG_ACPI_INTERPRETER),y)
+#  obj-y               += osl.o utils.o
+#  subdir-y    += dispatcher events executer hardware namespace parser \
+#                 resources tables utilities
+#  obj-y       += $(foreach dir,$(subdir-y),$(dir)/$(dir).o)
+#endif
+#
+#
+# ACPI Bus and Device Drivers
+#
+#ifeq ($(CONFIG_ACPI_BUS),y)
+#  obj-y                               += bus.o 
+#  obj-$(CONFIG_ACPI_AC)       += ac.o
+#  obj-$(CONFIG_ACPI_BATTERY)  += battery.o
+#  obj-$(CONFIG_ACPI_BUTTON)   += button.o
+#  obj-$(CONFIG_ACPI_EC)               += ec.o
+#  obj-$(CONFIG_ACPI_FAN)      += fan.o
+#  obj-$(CONFIG_ACPI_PCI)      += pci_root.o pci_link.o pci_irq.o pci_bind.o
+#  obj-$(CONFIG_ACPI_POWER)    += power.o
+#  obj-$(CONFIG_ACPI_PROCESSOR)        += processor.o
+#  obj-$(CONFIG_ACPI_THERMAL)  += thermal.o
+#  obj-$(CONFIG_ACPI_SYSTEM)   += system.o
+#  obj-$(CONFIG_ACPI_NUMA)     += numa.o
+#  obj-$(CONFIG_ACPI_ASUS)     += asus_acpi.o
+#  obj-$(CONFIG_ACPI_TOSHIBA)  += toshiba_acpi.o
+#endif
diff --git a/xen/drivers/acpi/acpi_ksyms.c b/xen/drivers/acpi/acpi_ksyms.c
new file mode 100644 (file)
index 0000000..3933d4e
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ *  acpi_ksyms.c - ACPI Kernel Symbols ($Revision: 15 $)
+ *
+ *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
+ *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#include <xen/module.h>
+#include <xen/acpi.h>
+
+#ifdef CONFIG_ACPI_INTERPRETER
+
+/* ACPI Debugger */
+
+#ifdef ENABLE_DEBUGGER
+
+extern int                     acpi_in_debugger;
+
+EXPORT_SYMBOL(acpi_in_debugger);
+EXPORT_SYMBOL(acpi_db_user_commands);
+
+#endif /* ENABLE_DEBUGGER */
+
+/* ACPI Core Subsystem */
+
+#ifdef ACPI_DEBUG_OUTPUT
+EXPORT_SYMBOL(acpi_dbg_layer);
+EXPORT_SYMBOL(acpi_dbg_level);
+EXPORT_SYMBOL(acpi_ut_debug_print_raw);
+EXPORT_SYMBOL(acpi_ut_debug_print);
+EXPORT_SYMBOL(acpi_ut_status_exit);
+EXPORT_SYMBOL(acpi_ut_value_exit);
+EXPORT_SYMBOL(acpi_ut_exit);
+EXPORT_SYMBOL(acpi_ut_trace);
+#endif /*ACPI_DEBUG_OUTPUT*/
+
+EXPORT_SYMBOL(acpi_get_handle);
+EXPORT_SYMBOL(acpi_get_parent);
+EXPORT_SYMBOL(acpi_get_type);
+EXPORT_SYMBOL(acpi_get_name);
+EXPORT_SYMBOL(acpi_get_object_info);
+EXPORT_SYMBOL(acpi_get_next_object);
+EXPORT_SYMBOL(acpi_evaluate_object);
+EXPORT_SYMBOL(acpi_get_table);
+EXPORT_SYMBOL(acpi_get_firmware_table);
+EXPORT_SYMBOL(acpi_install_notify_handler);
+EXPORT_SYMBOL(acpi_remove_notify_handler);
+EXPORT_SYMBOL(acpi_install_gpe_handler);
+EXPORT_SYMBOL(acpi_remove_gpe_handler);
+EXPORT_SYMBOL(acpi_install_address_space_handler);
+EXPORT_SYMBOL(acpi_remove_address_space_handler);
+EXPORT_SYMBOL(acpi_install_fixed_event_handler);
+EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
+EXPORT_SYMBOL(acpi_acquire_global_lock);
+EXPORT_SYMBOL(acpi_release_global_lock);
+EXPORT_SYMBOL(acpi_install_gpe_block);
+EXPORT_SYMBOL(acpi_remove_gpe_block);
+EXPORT_SYMBOL(acpi_get_current_resources);
+EXPORT_SYMBOL(acpi_get_possible_resources);
+EXPORT_SYMBOL(acpi_walk_resources);
+EXPORT_SYMBOL(acpi_set_current_resources);
+EXPORT_SYMBOL(acpi_enable_event);
+EXPORT_SYMBOL(acpi_disable_event);
+EXPORT_SYMBOL(acpi_clear_event);
+EXPORT_SYMBOL(acpi_get_timer_duration);
+EXPORT_SYMBOL(acpi_get_timer);
+EXPORT_SYMBOL(acpi_get_sleep_type_data);
+EXPORT_SYMBOL(acpi_get_register);
+EXPORT_SYMBOL(acpi_set_register);
+EXPORT_SYMBOL(acpi_enter_sleep_state);
+EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
+EXPORT_SYMBOL(acpi_get_system_info);
+EXPORT_SYMBOL(acpi_get_devices);
+
+/* ACPI OS Services Layer (acpi_osl.c) */
+
+EXPORT_SYMBOL(acpi_os_free);
+EXPORT_SYMBOL(acpi_os_printf);
+EXPORT_SYMBOL(acpi_os_sleep);
+EXPORT_SYMBOL(acpi_os_stall);
+EXPORT_SYMBOL(acpi_os_signal);
+EXPORT_SYMBOL(acpi_os_queue_for_execution);
+EXPORT_SYMBOL(acpi_os_signal_semaphore);
+EXPORT_SYMBOL(acpi_os_create_semaphore);
+EXPORT_SYMBOL(acpi_os_delete_semaphore);
+EXPORT_SYMBOL(acpi_os_wait_semaphore);
+
+EXPORT_SYMBOL(acpi_os_read_pci_configuration);
+
+/* ACPI Utilities (acpi_utils.c) */
+
+EXPORT_SYMBOL(acpi_extract_package);
+EXPORT_SYMBOL(acpi_evaluate_integer);
+EXPORT_SYMBOL(acpi_evaluate_reference);
+
+#endif /*CONFIG_ACPI_INTERPRETER*/
+
+
+/* ACPI Bus Driver (acpi_bus.c) */
+
+#ifdef CONFIG_ACPI_BUS
+
+EXPORT_SYMBOL(acpi_fadt);
+EXPORT_SYMBOL(acpi_walk_namespace);
+EXPORT_SYMBOL(acpi_root_dir);
+EXPORT_SYMBOL(acpi_bus_get_device);
+EXPORT_SYMBOL(acpi_bus_get_status);
+EXPORT_SYMBOL(acpi_bus_get_power);
+EXPORT_SYMBOL(acpi_bus_set_power);
+EXPORT_SYMBOL(acpi_bus_generate_event);
+EXPORT_SYMBOL(acpi_bus_receive_event);
+EXPORT_SYMBOL(acpi_bus_register_driver);
+EXPORT_SYMBOL(acpi_bus_unregister_driver);
+EXPORT_SYMBOL(acpi_bus_scan);
+EXPORT_SYMBOL(acpi_init);
+
+#endif /*CONFIG_ACPI_BUS*/
+
+
+/* ACPI PCI Driver (pci_irq.c) */
+
+#ifdef CONFIG_ACPI_PCI
+
+#include <xen/pci.h>
+extern int acpi_pci_irq_enable(struct pci_dev *dev);
+EXPORT_SYMBOL(acpi_pci_irq_enable);
+extern int acpi_pci_irq_lookup (int segment, int bus, int device, int pin);
+EXPORT_SYMBOL(acpi_pci_irq_lookup);
+EXPORT_SYMBOL(acpi_pci_register_driver);
+EXPORT_SYMBOL(acpi_pci_unregister_driver);
+#endif /*CONFIG_ACPI_PCI */
+
+#ifdef CONFIG_ACPI_EC
+/* ACPI EC driver (ec.c) */
+
+EXPORT_SYMBOL(ec_read);
+EXPORT_SYMBOL(ec_write);
+#endif
+
diff --git a/xen/drivers/acpi/tables.c b/xen/drivers/acpi/tables.c
new file mode 100644 (file)
index 0000000..64a0506
--- /dev/null
@@ -0,0 +1,588 @@
+/*
+ *  acpi_tables.c - ACPI Boot-Time Table Parsing
+ *
+ *  Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ */
+
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/kernel.h>
+#include <xen/sched.h>
+#include <xen/smp.h>
+#include <xen/string.h>
+#include <xen/types.h>
+#include <xen/irq.h>
+#include <xen/errno.h>
+#include <xen/acpi.h>
+/*#include <xen/bootmem.h>*/
+
+#define PREFIX                 "ACPI: "
+
+#define ACPI_MAX_TABLES                256
+
+static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
+       [ACPI_TABLE_UNKNOWN]    = "????",
+       [ACPI_APIC]             = "APIC",
+       [ACPI_BOOT]             = "BOOT",
+       [ACPI_DBGP]             = "DBGP",
+       [ACPI_DSDT]             = "DSDT",
+       [ACPI_ECDT]             = "ECDT",
+       [ACPI_ETDT]             = "ETDT",
+       [ACPI_FADT]             = "FACP",
+       [ACPI_FACS]             = "FACS",
+       [ACPI_OEMX]             = "OEM",
+       [ACPI_PSDT]             = "PSDT",
+       [ACPI_SBST]             = "SBST",
+       [ACPI_SLIT]             = "SLIT",
+       [ACPI_SPCR]             = "SPCR",
+       [ACPI_SRAT]             = "SRAT",
+       [ACPI_SSDT]             = "SSDT",
+       [ACPI_SPMI]             = "SPMI",
+       [ACPI_HPET]             = "HPET",
+};
+
+static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" };
+static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
+
+/* System Description Table (RSDT/XSDT) */
+struct acpi_table_sdt {
+       unsigned long           pa;
+       enum acpi_table_id      id;
+       unsigned long           size;
+} __attribute__ ((packed));
+
+static unsigned long           sdt_pa;         /* Physical Address */
+static unsigned long           sdt_count;      /* Table count */
+
+static struct acpi_table_sdt   sdt_entry[ACPI_MAX_TABLES];
+
+void
+acpi_table_print (
+       struct acpi_table_header *header,
+       unsigned long           phys_addr)
+{
+       char                    *name = NULL;
+
+       if (!header)
+               return;
+
+       /* Some table signatures aren't good table names */
+
+       if (!strncmp((char *) &header->signature,
+               acpi_table_signatures[ACPI_APIC],
+               sizeof(header->signature))) {
+               name = "MADT";
+       }
+       else if (!strncmp((char *) &header->signature,
+               acpi_table_signatures[ACPI_FADT],
+               sizeof(header->signature))) {
+               name = "FADT";
+       }
+       else
+               name = header->signature;
+
+       printk(KERN_INFO PREFIX "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n",
+               name, header->revision, header->oem_id,
+               header->oem_table_id, header->oem_revision,
+               header->asl_compiler_id, header->asl_compiler_revision,
+               (void *) phys_addr);
+}
+
+
+void
+acpi_table_print_madt_entry (
+       acpi_table_entry_header *header)
+{
+       if (!header)
+               return;
+
+       switch (header->type) {
+
+       case ACPI_MADT_LAPIC:
+       {
+               struct acpi_table_lapic *p =
+                       (struct acpi_table_lapic*) header;
+               printk(KERN_INFO PREFIX "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
+                       p->acpi_id, p->id, p->flags.enabled?"enabled":"disabled");
+       }
+               break;
+
+       case ACPI_MADT_IOAPIC:
+       {
+               struct acpi_table_ioapic *p =
+                       (struct acpi_table_ioapic*) header;
+               printk(KERN_INFO PREFIX "IOAPIC (id[0x%02x] address[0x%08x] global_irq_base[0x%x])\n",
+                       p->id, p->address, p->global_irq_base);
+       }
+               break;
+
+       case ACPI_MADT_INT_SRC_OVR:
+       {
+               struct acpi_table_int_src_ovr *p =
+                       (struct acpi_table_int_src_ovr*) header;
+               printk(KERN_INFO PREFIX "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
+                       p->bus, p->bus_irq, p->global_irq,
+                       mps_inti_flags_polarity[p->flags.polarity],
+                       mps_inti_flags_trigger[p->flags.trigger]);
+               if(p->flags.reserved)
+                       printk(KERN_INFO PREFIX "INT_SRC_OVR unexpected reserved flags: 0x%x\n",
+                               p->flags.reserved);
+
+       }
+               break;
+
+       case ACPI_MADT_NMI_SRC:
+       {
+               struct acpi_table_nmi_src *p =
+                       (struct acpi_table_nmi_src*) header;
+               printk(KERN_INFO PREFIX "NMI_SRC (%s %s global_irq %d)\n",
+                       mps_inti_flags_polarity[p->flags.polarity],
+                       mps_inti_flags_trigger[p->flags.trigger], p->global_irq);
+       }
+               break;
+
+       case ACPI_MADT_LAPIC_NMI:
+       {
+               struct acpi_table_lapic_nmi *p =
+                       (struct acpi_table_lapic_nmi*) header;
+               printk(KERN_INFO PREFIX "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
+                       p->acpi_id,
+                       mps_inti_flags_polarity[p->flags.polarity],
+                       mps_inti_flags_trigger[p->flags.trigger], p->lint);
+       }
+               break;
+
+       case ACPI_MADT_LAPIC_ADDR_OVR:
+       {
+               struct acpi_table_lapic_addr_ovr *p =
+                       (struct acpi_table_lapic_addr_ovr*) header;
+               printk(KERN_INFO PREFIX "LAPIC_ADDR_OVR (address[%p])\n",
+                       (void *) (unsigned long) p->address);
+       }
+               break;
+
+       case ACPI_MADT_IOSAPIC:
+       {
+               struct acpi_table_iosapic *p =
+                       (struct acpi_table_iosapic*) header;
+               printk(KERN_INFO PREFIX "IOSAPIC (id[0x%x] global_irq_base[0x%x] address[%p])\n",
+                       p->id, p->global_irq_base, (void *) (unsigned long) p->address);
+       }
+               break;
+
+       case ACPI_MADT_LSAPIC:
+       {
+               struct acpi_table_lsapic *p =
+                       (struct acpi_table_lsapic*) header;
+               printk(KERN_INFO PREFIX "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
+                       p->acpi_id, p->id, p->eid, p->flags.enabled?"enabled":"disabled");
+       }
+               break;
+
+       case ACPI_MADT_PLAT_INT_SRC:
+       {
+               struct acpi_table_plat_int_src *p =
+                       (struct acpi_table_plat_int_src*) header;
+               printk(KERN_INFO PREFIX "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
+                       mps_inti_flags_polarity[p->flags.polarity],
+                       mps_inti_flags_trigger[p->flags.trigger],
+                       p->type, p->id, p->eid, p->iosapic_vector, p->global_irq);
+       }
+               break;
+
+       default:
+               printk(KERN_WARNING PREFIX "Found unsupported MADT entry (type = 0x%x)\n",
+                       header->type);
+               break;
+       }
+}
+
+
+static int
+acpi_table_compute_checksum (
+       void                    *table_pointer,
+       unsigned long           length)
+{
+       u8                      *p = (u8 *) table_pointer;
+       unsigned long           remains = length;
+       unsigned long           sum = 0;
+
+       if (!p || !length)
+               return -EINVAL;
+
+       while (remains--)
+               sum += *p++;
+
+       return (sum & 0xFF);
+}
+
+/*
+ * acpi_get_table_header_early()
+ * for acpi_blacklisted(), acpi_table_get_sdt()
+ */
+int __init
+acpi_get_table_header_early (
+       enum acpi_table_id      id,
+       struct acpi_table_header **header)
+{
+       unsigned int i;
+       enum acpi_table_id temp_id;
+
+       /* DSDT is different from the rest */
+       if (id == ACPI_DSDT)
+               temp_id = ACPI_FADT;
+       else
+               temp_id = id;
+
+       /* Locate the table. */
+
+       for (i = 0; i < sdt_count; i++) {
+               if (sdt_entry[i].id != temp_id)
+                       continue;
+               *header = (void *)
+                       __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
+               if (!*header) {
+                       printk(KERN_WARNING PREFIX "Unable to map %s\n",
+                              acpi_table_signatures[temp_id]);
+                       return -ENODEV;
+               }
+               break;
+       }
+
+       if (!*header) {
+               printk(KERN_WARNING PREFIX "%s not present\n",
+                      acpi_table_signatures[id]);
+               return -ENODEV;
+       }
+
+       /* Map the DSDT header via the pointer in the FADT */
+       if (id == ACPI_DSDT) {
+               struct fadt_descriptor_rev2 *fadt = (struct fadt_descriptor_rev2 *) *header;
+
+               if (fadt->revision == 3 && fadt->Xdsdt) {
+                       *header = (void *) __acpi_map_table(fadt->Xdsdt,
+                                       sizeof(struct acpi_table_header));
+               } else if (fadt->V1_dsdt) {
+                       *header = (void *) __acpi_map_table(fadt->V1_dsdt,
+                                       sizeof(struct acpi_table_header));
+               } else
+                       *header = 0;
+
+               if (!*header) {
+                       printk(KERN_WARNING PREFIX "Unable to map DSDT\n");
+                       return -ENODEV;
+               }
+       }
+
+       return 0;
+}
+        
+
+int __init
+acpi_table_parse_madt_family (
+       enum acpi_table_id      id,
+       unsigned long           madt_size,
+       int                     entry_id,
+       acpi_madt_entry_handler handler)
+{
+       void                    *madt = NULL;
+       acpi_table_entry_header *entry = NULL;
+       unsigned long           count = 0;
+       unsigned long           madt_end = 0;
+       unsigned int                    i = 0;
+
+       if (!handler)
+               return -EINVAL;
+
+       /* Locate the MADT (if exists). There should only be one. */
+
+       for (i = 0; i < sdt_count; i++) {
+               if (sdt_entry[i].id != id)
+                       continue;
+               madt = (void *)
+                       __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
+               if (!madt) {
+                       printk(KERN_WARNING PREFIX "Unable to map %s\n",
+                              acpi_table_signatures[id]);
+                       return -ENODEV;
+               }
+               break;
+       }
+
+       if (!madt) {
+               printk(KERN_WARNING PREFIX "%s not present\n",
+                      acpi_table_signatures[id]);
+               return -ENODEV;
+       }
+
+       madt_end = (unsigned long) madt + sdt_entry[i].size;
+
+       /* Parse all entries looking for a match. */
+
+       entry = (acpi_table_entry_header *)
+               ((unsigned long) madt + madt_size);
+
+       while (((unsigned long) entry) < madt_end) {
+               if (entry->type == entry_id) {
+                       count++;
+                       handler(entry);
+               }
+               entry = (acpi_table_entry_header *)
+                       ((unsigned long) entry + entry->length);
+       }
+
+       return count;
+}
+
+
+int __init
+acpi_table_parse_madt (
+       enum acpi_madt_entry_id id,
+       acpi_madt_entry_handler handler)
+{
+       return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt),
+                                           id, handler);
+}
+
+
+int __init
+acpi_table_parse (
+       enum acpi_table_id      id,
+       acpi_table_handler      handler)
+{
+       int                     count = 0;
+       unsigned int            i = 0;
+
+       if (!handler)
+               return -EINVAL;
+
+       for (i = 0; i < sdt_count; i++) {
+               if (sdt_entry[i].id != id)
+                       continue;
+               handler(sdt_entry[i].pa, sdt_entry[i].size);
+               count++;
+       }
+
+       return count;
+}
+
+
+static int __init
+acpi_table_get_sdt (
+       struct acpi_table_rsdp  *rsdp)
+{
+       struct acpi_table_header *header = NULL;
+       unsigned int            i, id = 0;
+
+       if (!rsdp)
+               return -EINVAL;
+
+       /* First check XSDT (but only on ACPI 2.0-compatible systems) */
+
+       if ((rsdp->revision >= 2) &&
+               (((struct acpi20_table_rsdp*)rsdp)->xsdt_address)) {
+                       
+               struct acpi_table_xsdt  *mapped_xsdt = NULL;
+
+               sdt_pa = ((struct acpi20_table_rsdp*)rsdp)->xsdt_address;
+
+               /* map in just the header */
+               header = (struct acpi_table_header *)
+                       __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
+
+               if (!header) {
+                       printk(KERN_WARNING PREFIX "Unable to map XSDT header\n");
+                       return -ENODEV;
+               }
+
+               /* remap in the entire table before processing */
+               mapped_xsdt = (struct acpi_table_xsdt *)
+                       __acpi_map_table(sdt_pa, header->length);
+               if (!mapped_xsdt) {
+                       printk(KERN_WARNING PREFIX "Unable to map XSDT\n");
+                       return -ENODEV;
+               }
+               header = &mapped_xsdt->header;
+
+               if (strncmp(header->signature, "XSDT", 4)) {
+                       printk(KERN_WARNING PREFIX "XSDT signature incorrect\n");
+                       return -ENODEV;
+               }
+
+               if (acpi_table_compute_checksum(header, header->length)) {
+                       printk(KERN_WARNING PREFIX "Invalid XSDT checksum\n");
+                       return -ENODEV;
+               }
+
+               sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 3;
+               if (sdt_count > ACPI_MAX_TABLES) {
+                       printk(KERN_WARNING PREFIX "Truncated %lu XSDT entries\n",
+                               (sdt_count - ACPI_MAX_TABLES));
+                       sdt_count = ACPI_MAX_TABLES;
+               }
+
+               for (i = 0; i < sdt_count; i++)
+                       sdt_entry[i].pa = (unsigned long) mapped_xsdt->entry[i];
+       }
+
+       /* Then check RSDT */
+
+       else if (rsdp->rsdt_address) {
+
+               struct acpi_table_rsdt  *mapped_rsdt = NULL;
+
+               sdt_pa = rsdp->rsdt_address;
+
+               /* map in just the header */
+               header = (struct acpi_table_header *)
+                       __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
+               if (!header) {
+                       printk(KERN_WARNING PREFIX "Unable to map RSDT header\n");
+                       return -ENODEV;
+               }
+
+               /* remap in the entire table before processing */
+               mapped_rsdt = (struct acpi_table_rsdt *)
+                       __acpi_map_table(sdt_pa, header->length);
+               if (!mapped_rsdt) {
+                       printk(KERN_WARNING PREFIX "Unable to map RSDT\n");
+                       return -ENODEV;
+               }
+               header = &mapped_rsdt->header;
+
+               if (strncmp(header->signature, "RSDT", 4)) {
+                       printk(KERN_WARNING PREFIX "RSDT signature incorrect\n");
+                       return -ENODEV;
+               }
+
+               if (acpi_table_compute_checksum(header, header->length)) {
+                       printk(KERN_WARNING PREFIX "Invalid RSDT checksum\n");
+                       return -ENODEV;
+               }
+
+               sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 2;
+               if (sdt_count > ACPI_MAX_TABLES) {
+                       printk(KERN_WARNING PREFIX "Truncated %lu RSDT entries\n",
+                               (sdt_count - ACPI_MAX_TABLES));
+                       sdt_count = ACPI_MAX_TABLES;
+               }
+
+               for (i = 0; i < sdt_count; i++)
+                       sdt_entry[i].pa = (unsigned long) mapped_rsdt->entry[i];
+       }
+
+       else {
+               printk(KERN_WARNING PREFIX "No System Description Table (RSDT/XSDT) specified in RSDP\n");
+               return -ENODEV;
+       }
+
+       acpi_table_print(header, sdt_pa);
+
+       for (i = 0; i < sdt_count; i++) {
+
+               /* map in just the header */
+               header = (struct acpi_table_header *)
+                       __acpi_map_table(sdt_entry[i].pa,
+                               sizeof(struct acpi_table_header));
+               if (!header)
+                       continue;
+
+               /* remap in the entire table before processing */
+               header = (struct acpi_table_header *)
+                       __acpi_map_table(sdt_entry[i].pa,
+                               header->length);
+               if (!header)
+                       continue;
+                      
+               acpi_table_print(header, sdt_entry[i].pa);
+
+               if (acpi_table_compute_checksum(header, header->length)) {
+                       printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
+                       continue;
+               }
+
+               sdt_entry[i].size = header->length;
+
+               for (id = 0; id < ACPI_TABLE_COUNT; id++) {
+                       if (!strncmp((char *) &header->signature,
+                               acpi_table_signatures[id],
+                               sizeof(header->signature))) {
+                               sdt_entry[i].id = id;
+                       }
+               }
+       }
+
+       /* 
+        * The DSDT is *not* in the RSDT (why not? no idea.) but we want
+        * to print its info, because this is what people usually blacklist
+        * against. Unfortunately, we don't know the phys_addr, so just
+        * print 0. Maybe no one will notice.
+        */
+       if(!acpi_get_table_header_early(ACPI_DSDT, &header))
+               acpi_table_print(header, 0);
+
+       return 0;
+}
+
+
+int __init
+acpi_table_init (void)
+{
+       struct acpi_table_rsdp  *rsdp = NULL;
+       unsigned long           rsdp_phys = 0;
+       int                     result = 0;
+
+       /* Locate and map the Root System Description Table (RSDP) */
+
+       rsdp_phys = acpi_find_rsdp();
+       if (!rsdp_phys) {
+               printk(KERN_ERR PREFIX "Unable to locate RSDP\n");
+               return -ENODEV;
+       }
+
+       rsdp = (struct acpi_table_rsdp *) __va(rsdp_phys);
+       if (!rsdp) {
+               printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
+               return -ENODEV;
+       }
+
+       printk(KERN_INFO PREFIX "RSDP (v%3.3d %6.6s                                    ) @ 0x%p\n",
+               rsdp->revision, rsdp->oem_id, (void *) rsdp_phys);
+
+       if (rsdp->revision < 2)
+               result = acpi_table_compute_checksum(rsdp, sizeof(struct acpi_table_rsdp));
+       else
+               result = acpi_table_compute_checksum(rsdp, ((struct acpi20_table_rsdp *)rsdp)->length);
+
+       if (result) {
+               printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
+               return -ENODEV;
+       }
+
+       /* Locate and map the System Description table (RSDT/XSDT) */
+
+       if (acpi_table_get_sdt(rsdp))
+               return -ENODEV;
+
+       return 0;
+}
+
diff --git a/xen/drivers/acpi_ksyms.c b/xen/drivers/acpi_ksyms.c
new file mode 100644 (file)
index 0000000..3933d4e
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ *  acpi_ksyms.c - ACPI Kernel Symbols ($Revision: 15 $)
+ *
+ *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
+ *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#include <xen/module.h>
+#include <xen/acpi.h>
+
+#ifdef CONFIG_ACPI_INTERPRETER
+
+/* ACPI Debugger */
+
+#ifdef ENABLE_DEBUGGER
+
+extern int                     acpi_in_debugger;
+
+EXPORT_SYMBOL(acpi_in_debugger);
+EXPORT_SYMBOL(acpi_db_user_commands);
+
+#endif /* ENABLE_DEBUGGER */
+
+/* ACPI Core Subsystem */
+
+#ifdef ACPI_DEBUG_OUTPUT
+EXPORT_SYMBOL(acpi_dbg_layer);
+EXPORT_SYMBOL(acpi_dbg_level);
+EXPORT_SYMBOL(acpi_ut_debug_print_raw);
+EXPORT_SYMBOL(acpi_ut_debug_print);
+EXPORT_SYMBOL(acpi_ut_status_exit);
+EXPORT_SYMBOL(acpi_ut_value_exit);
+EXPORT_SYMBOL(acpi_ut_exit);
+EXPORT_SYMBOL(acpi_ut_trace);
+#endif /*ACPI_DEBUG_OUTPUT*/
+
+EXPORT_SYMBOL(acpi_get_handle);
+EXPORT_SYMBOL(acpi_get_parent);
+EXPORT_SYMBOL(acpi_get_type);
+EXPORT_SYMBOL(acpi_get_name);
+EXPORT_SYMBOL(acpi_get_object_info);
+EXPORT_SYMBOL(acpi_get_next_object);
+EXPORT_SYMBOL(acpi_evaluate_object);
+EXPORT_SYMBOL(acpi_get_table);
+EXPORT_SYMBOL(acpi_get_firmware_table);
+EXPORT_SYMBOL(acpi_install_notify_handler);
+EXPORT_SYMBOL(acpi_remove_notify_handler);
+EXPORT_SYMBOL(acpi_install_gpe_handler);
+EXPORT_SYMBOL(acpi_remove_gpe_handler);
+EXPORT_SYMBOL(acpi_install_address_space_handler);
+EXPORT_SYMBOL(acpi_remove_address_space_handler);
+EXPORT_SYMBOL(acpi_install_fixed_event_handler);
+EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
+EXPORT_SYMBOL(acpi_acquire_global_lock);
+EXPORT_SYMBOL(acpi_release_global_lock);
+EXPORT_SYMBOL(acpi_install_gpe_block);
+EXPORT_SYMBOL(acpi_remove_gpe_block);
+EXPORT_SYMBOL(acpi_get_current_resources);
+EXPORT_SYMBOL(acpi_get_possible_resources);
+EXPORT_SYMBOL(acpi_walk_resources);
+EXPORT_SYMBOL(acpi_set_current_resources);
+EXPORT_SYMBOL(acpi_enable_event);
+EXPORT_SYMBOL(acpi_disable_event);
+EXPORT_SYMBOL(acpi_clear_event);
+EXPORT_SYMBOL(acpi_get_timer_duration);
+EXPORT_SYMBOL(acpi_get_timer);
+EXPORT_SYMBOL(acpi_get_sleep_type_data);
+EXPORT_SYMBOL(acpi_get_register);
+EXPORT_SYMBOL(acpi_set_register);
+EXPORT_SYMBOL(acpi_enter_sleep_state);
+EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
+EXPORT_SYMBOL(acpi_get_system_info);
+EXPORT_SYMBOL(acpi_get_devices);
+
+/* ACPI OS Services Layer (acpi_osl.c) */
+
+EXPORT_SYMBOL(acpi_os_free);
+EXPORT_SYMBOL(acpi_os_printf);
+EXPORT_SYMBOL(acpi_os_sleep);
+EXPORT_SYMBOL(acpi_os_stall);
+EXPORT_SYMBOL(acpi_os_signal);
+EXPORT_SYMBOL(acpi_os_queue_for_execution);
+EXPORT_SYMBOL(acpi_os_signal_semaphore);
+EXPORT_SYMBOL(acpi_os_create_semaphore);
+EXPORT_SYMBOL(acpi_os_delete_semaphore);
+EXPORT_SYMBOL(acpi_os_wait_semaphore);
+
+EXPORT_SYMBOL(acpi_os_read_pci_configuration);
+
+/* ACPI Utilities (acpi_utils.c) */
+
+EXPORT_SYMBOL(acpi_extract_package);
+EXPORT_SYMBOL(acpi_evaluate_integer);
+EXPORT_SYMBOL(acpi_evaluate_reference);
+
+#endif /*CONFIG_ACPI_INTERPRETER*/
+
+
+/* ACPI Bus Driver (acpi_bus.c) */
+
+#ifdef CONFIG_ACPI_BUS
+
+EXPORT_SYMBOL(acpi_fadt);
+EXPORT_SYMBOL(acpi_walk_namespace);
+EXPORT_SYMBOL(acpi_root_dir);
+EXPORT_SYMBOL(acpi_bus_get_device);
+EXPORT_SYMBOL(acpi_bus_get_status);
+EXPORT_SYMBOL(acpi_bus_get_power);
+EXPORT_SYMBOL(acpi_bus_set_power);
+EXPORT_SYMBOL(acpi_bus_generate_event);
+EXPORT_SYMBOL(acpi_bus_receive_event);
+EXPORT_SYMBOL(acpi_bus_register_driver);
+EXPORT_SYMBOL(acpi_bus_unregister_driver);
+EXPORT_SYMBOL(acpi_bus_scan);
+EXPORT_SYMBOL(acpi_init);
+
+#endif /*CONFIG_ACPI_BUS*/
+
+
+/* ACPI PCI Driver (pci_irq.c) */
+
+#ifdef CONFIG_ACPI_PCI
+
+#include <xen/pci.h>
+extern int acpi_pci_irq_enable(struct pci_dev *dev);
+EXPORT_SYMBOL(acpi_pci_irq_enable);
+extern int acpi_pci_irq_lookup (int segment, int bus, int device, int pin);
+EXPORT_SYMBOL(acpi_pci_irq_lookup);
+EXPORT_SYMBOL(acpi_pci_register_driver);
+EXPORT_SYMBOL(acpi_pci_unregister_driver);
+#endif /*CONFIG_ACPI_PCI */
+
+#ifdef CONFIG_ACPI_EC
+/* ACPI EC driver (ec.c) */
+
+EXPORT_SYMBOL(ec_read);
+EXPORT_SYMBOL(ec_write);
+#endif
+
index a906152048b97aba43a622c01dc5eb8ca27c2e31..f6d77e4e7ac1880b7a30f417f4ea854dc7bb1a42 100644 (file)
@@ -775,7 +775,7 @@ static int init_irq (ide_hwif_t *hwif)
        restore_flags(flags);   /* all CPUs; safe now that hwif->hwgroup is set up */
 
 #if !defined(__mc68000__) && !defined(CONFIG_APUS) && !defined(__sparc__)
-       printk("%s at 0x%03x-0x%03x,0x%03x on irq %d", hwif->name,
+       printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name,
                hwif->io_ports[IDE_DATA_OFFSET],
                hwif->io_ports[IDE_DATA_OFFSET]+7,
                hwif->io_ports[IDE_CONTROL_OFFSET], hwif->irq);
index fa606c7fbc2326cdfda9ce31878e3562372efc32..4f31a003ac1078dc0a953ab9fce71815a2615e9f 100644 (file)
@@ -907,8 +907,12 @@ pci_set_master(struct pci_dev *dev)
        pcibios_set_master(dev);
 }
 
+#ifndef HAVE_ARCH_PCI_MWI
+/* This can be overridden by arch code. */
+u8 pci_cache_line_size = L1_CACHE_BYTES >> 2;
+
 /**
- * pdev_set_mwi - arch helper function for pcibios_set_mwi
+ * pci_generic_prep_mwi - helper function for pci_set_mwi
  * @dev: the PCI device for which MWI is enabled
  *
  * Helper function for implementation the arch-specific pcibios_set_mwi
@@ -917,35 +921,34 @@ pci_set_master(struct pci_dev *dev)
  *
  * RETURNS: An appriopriate -ERRNO error value on eror, or zero for success.
  */
-int
-pdev_set_mwi(struct pci_dev *dev)
+static int
+pci_generic_prep_mwi(struct pci_dev *dev)
 {
-       int rc = 0;
-       u8 cache_size;
+       u8 cacheline_size;
 
-       /*
-        * Looks like this is necessary to deal with on all architectures,
-        * even this %$#%$# N440BX Intel based thing doesn't get it right.
-        * Ie. having two NICs in the machine, one will have the cache
-        * line set at boot time, the other will not.
-        */
-       pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, &cache_size);
-       cache_size <<= 2;
-       if (cache_size != SMP_CACHE_BYTES) {
-               printk(KERN_WARNING "PCI: %s PCI cache line size set incorrectly (%i bytes) by BIOS/FW.\n",
-                      dev->slot_name, cache_size);
-               if (cache_size > SMP_CACHE_BYTES) {
-                       printk("PCI: %s cache line size too large - expecting %i.\n", dev->slot_name, SMP_CACHE_BYTES);
-                       rc = -EINVAL;
-               } else {
-                       printk("PCI: %s PCI cache line size corrected to %i.\n", dev->slot_name, SMP_CACHE_BYTES);
-                       pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
-                                             SMP_CACHE_BYTES >> 2);
-               }
-       }
+       if (!pci_cache_line_size)
+               return -EINVAL;         /* The system doesn't support MWI. */
+
+       /* Validate current setting: the PCI_CACHE_LINE_SIZE must be
+          equal to or multiple of the right value. */
+       pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, &cacheline_size);
+       if (cacheline_size >= pci_cache_line_size &&
+           (cacheline_size % pci_cache_line_size) == 0)
+               return 0;
 
-       return rc;
+       /* Write the correct value. */
+       pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, pci_cache_line_size);
+       /* Read it back. */
+       pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, &cacheline_size);
+       if (cacheline_size == pci_cache_line_size)
+               return 0;
+
+       printk(KERN_WARNING "PCI: cache line size of %d is not supported "
+              "by device %s\n", pci_cache_line_size << 2, dev->slot_name);
+
+       return -EINVAL;
 }
+#endif /* !HAVE_ARCH_PCI_MWI */
 
 /**
  * pci_set_mwi - enables memory-write-invalidate PCI transaction
@@ -966,7 +969,7 @@ pci_set_mwi(struct pci_dev *dev)
 #ifdef HAVE_ARCH_PCI_MWI
        rc = pcibios_set_mwi(dev);
 #else
-       rc = pdev_set_mwi(dev);
+       rc = pci_generic_prep_mwi(dev);
 #endif
 
        if (rc)
@@ -1257,10 +1260,6 @@ struct pci_bus * __devinit pci_add_new_bus(struct pci_bus *parent, struct pci_de
                child->resource[i]->name = child->name;
        }
 
-       DBG("pci_add_new_bus(nr=%x,devfn=%02x(%02x:%x),parent=%x)\n",
-           busnr, dev->devfn, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn),
-           parent->number);
-
        return child;
 }
 
@@ -1474,17 +1473,22 @@ struct pci_dev * __devinit pci_scan_slot(struct pci_dev *temp)
        u8 hdr_type;
 
        for (func = 0; func < 8; func++, temp->devfn++) {
-               if (func && !is_multi)          /* not a multi-function device */
-                       continue;
                if (pci_read_config_byte(temp, PCI_HEADER_TYPE, &hdr_type))
                        continue;
                temp->hdr_type = hdr_type & 0x7f;
 
                dev = pci_scan_device(temp);
-               if (!dev)
-                       continue;
+               if (!pcibios_scan_all_fns() && func == 0) {
+                       if (!dev)
+                               break;
+               } else {
+                       if (!dev)
+                               continue;
+                       is_multi = 1;
+               }
+
                pci_name_device(dev);
-               if (!func) {
+               if (!first_dev) {
                        is_multi = hdr_type & 0x80;
                        first_dev = dev;
                }
@@ -1498,6 +1502,14 @@ struct pci_dev * __devinit pci_scan_slot(struct pci_dev *temp)
 
                /* Fix up broken headers */
                pci_fixup_device(PCI_FIXUP_HEADER, dev);
+
+               /*
+                * If this is a single function device
+                * don't scan past the first function.
+                */
+               if (!is_multi)
+                       break;
+
        }
        return first_dev;
 }
@@ -2114,19 +2126,6 @@ void __devinit  pci_init(void)
 
        pci_for_each_dev(dev) {
                pci_fixup_device(PCI_FIXUP_FINAL, dev);
-#ifdef DEBUG
-               printk("PCI: %p %02x:%02x:%02x\n", dev,
-                      dev->bus ? dev->bus->number : 0xffffffff, 
-                      PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
-               if (dev->bus) {
-                       printk(" s=%p ", dev->bus->self);
-                       if ( dev->bus->self )
-                               printk(" %02x:%02x)",
-                                      PCI_SLOT(dev->bus->self->devfn),
-                                      PCI_FUNC(dev->bus->self->devfn));
-                       printk("\n");
-               }
-#endif /* DEBUG */
        }
 
 #ifdef CONFIG_PM
@@ -2174,7 +2173,6 @@ EXPORT_SYMBOL(pci_find_subsys);
 EXPORT_SYMBOL(pci_set_master);
 EXPORT_SYMBOL(pci_set_mwi);
 EXPORT_SYMBOL(pci_clear_mwi);
-EXPORT_SYMBOL(pdev_set_mwi);
 EXPORT_SYMBOL(pci_set_dma_mask);
 EXPORT_SYMBOL(pci_dac_set_dma_mask);
 EXPORT_SYMBOL(pci_assign_resource);
index 845f545bf285f60c65a2a9d415471ca5e77da31a..29843852e935ad8a022829d0ba49f8156d20b540 100644 (file)
@@ -7,7 +7,8 @@
 #      so if you have anything to contribute, please visit the home page or
 #      send a diff -u against the most recent pci.ids to pci-ids@ucw.cz.
 #
-#      $Id: pci.ids,v 1.46 2002/08/14 17:38:51 mares Exp $
+#      Daily snapshot on Thu 2003-05-29 10:00:04
+#      Modded on Fri 2003-05-30 03:13:05
 #
 
 # Vendors, devices and subsystems. Please keep sorted.
@@ -21,6 +22,8 @@
 001a  Ascend Communications, Inc.
 0033  Paradyne corp.
 003d  Lockheed Martin-Marietta Corp
+# Real TJN ID is e159, but they got it wrong several times --mj
+0059  Tiger Jet Network Inc. (Wrong ID)
 0070  Hauppauge computer works Inc.
 0100  Ncipher Corp Ltd
 0675  Dynalink
        f130  NetFlex-3/P ThunderLAN 1.0
        f150  NetFlex-3/P ThunderLAN 2.3
 0e55  HaSoTec GmbH
-1000  LSI Logic / Symbios Logic (formerly NCR)
+# Formerly NCR
+1000  LSI Logic / Symbios Logic
        0001  53c810
                1000 1000  8100S
        0002  53c820
        0020  53c1010 Ultra3 SCSI Adapter
                1de1 1020  DC-390U3W
        0021  53c1010 66MHz  Ultra3 SCSI Adapter
-       0030  53c1030
+       0030  53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI
                1028 1010  LSI U320 SCSI Controller
        0040  53c1035
        008f  53c875J
        0017  PROTO-3 PCI Prototyping board
        9100  INI-9100/9100W SCSI Host
 1002  ATI Technologies Inc
+       4136  Radeon IGP 320 M
+# New support forthcoming in XFree86 4.3.0
+       4144  Radeon R300 AD [Radeon 9500 Pro]
+# New support forthcoming in XFree86 4.3.0
+       4145  Radeon R300 AE [Radeon 9500 Pro]
+# New support forthcoming in XFree86 4.3.0
+       4146  Radeon R300 AF [Radeon 9500 Pro]
+# Update:  Oops, AF was a typo above for 4147, should be AG
+       4147  Radeon R300 AG [FireGL Z1/X1]
        4158  68800AX [Mach32]
-       4242  Radeon 8500 DV
+       4242  Radeon R200 BB [Radeon All in Wonder 8500DV]
                1002 02aa  Radeon 8500 AIW DV Edition
+       4336  Radeon Mobility U1
+       4337  Radeon IGP 340M
        4354  215CT [Mach64 CT]
        4358  210888CX [Mach64 CX]
        4554  210888ET [Mach64 ET]
        4752  Rage XL
                1002 0008  Rage XL
                1002 4752  Rage XL
+               1002 8008  Rage XL
+               1028 00d1  PowerEdge 2550
        4753  Rage XC
                1002 4753  Rage XC
        4754  3D Rage I/II 215GT [Mach64 GT]
        475a  3D Rage IIC AGP
                1002 0087  Rage 3D IIC
                1002 475a  Rage IIC AGP
+       4964  Radeon R250 Id [Radeon 9000]
+       4965  Radeon R250 Ie [Radeon 9000]
+       4966  Radeon R250 If [Radeon 9000]
+               10f1 0002  R250 If [Tachyon G9000 PRO]
+               148c 2039  R250 If [Radeon 9000 Pro "Evil Commando"]
+               1509 9a00  R250 If [Radeon 9000 "AT009"]
+# New subdevice - 3D Prophet 9000 PCI by Hercules.  AGP version probably would have same ID, so not specified.
+               1681 0040  R250 If [3D prophet 9000]
+               174b 7176  R250 If [Sapphire Radeon 9000 Pro]
+               174b 7192  R250 If [Radeon 9000 "Atlantis"]
+               17af 2005  R250 If [Excalibur Radeon 9000 Pro]
+               17af 2006  R250 If [Excalibur Radeon 9000]
+       4967  Radeon R250 Ig [Radeon 9000]
+       496e  Radeon R250 [Radeon 9000] (Secondary)
        4c42  3D Rage LT Pro AGP-133
                0e11 b0e8  Rage 3D LT Pro
                0e11 b10e  3D Rage LT Pro (Compaq Armada 1750)
                1002 0044  Rage LT Pro
                1002 4c49  Rage LT Pro
        4c4d  Rage Mobility P/M AGP 2x
+               0e11 b111  Armada M700
                1002 0084  Xpert 98 AGP 2X (Mobility)
+               1014 0154  ThinkPad A20m
        4c4e  Rage Mobility L AGP 2x
        4c50  3D Rage LT Pro
                1002 4c50  Rage LT Pro
        4c52  Rage Mobility P/M
        4c53  Rage Mobility L
        4c54  264LT [Mach64 LT]
-       4c57  Radeon Mobility M7 LW
+       4c57  Radeon Mobility M7 LW [Radeon Mobility 7500]
+               1014 0517  ThinkPad T30
                1028 00e6  Radeon Mobility M7 LW (Dell Inspiron 8100)
-       4c58  Radeon Mobility M7 LX [Radeon Mobility FireGL 7800]
+               144d c006  Radeon Mobility M7 LW in vpr Matrix 170B4
+# Update:  More correct labelling for this FireGL chipset
+       4c58  Radeon RV200 LX [Mobility FireGL 7800 M7]
        4c59  Radeon Mobility M6 LY
                1014 0235  ThinkPad A30p (2653-64G)
                1014 0239  ThinkPad X22/X23/X24
                104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
        4c5a  Radeon Mobility M6 LZ
+# Update:  Add M9 to product name
+       4c64  Radeon R250 Ld [Radeon Mobility 9000 M9]
+# Update:  Add M9 to product name
+       4c65  Radeon R250 Le [Radeon Mobility 9000 M9]
+# Update:  Add M9 to product name
+       4c66  Radeon R250 Lf [Radeon Mobility 9000 M9]
+# Update:  Add M9 to product name
+       4c67  Radeon R250 Lg [Radeon Mobility 9000 M9]
        4d46  Rage Mobility M4 AGP
        4d4c  Rage Mobility M4 AGP
+       4e44  Radeon R300 ND [Radeon 9700 Pro]
+       4e45  Radeon R300 NE [Radeon 9500 Pro]
+               1002 0002  Radeon R300 NE [Radeon 9500 Pro]
+       4e46  Radeon R300 NF [Radeon 9700]
+# Update:  This is FireGL X1, not Radeon 9700
+       4e47  Radeon R300 NG [FireGL X1]
+       4e48  Radeon R350 [Radeon 9800]
+       4e64  Radeon R300 [Radeon 9700 Pro] (Secondary)
+       4e65  Radeon R300 [Radeon 9500 Pro] (Secondary)
+       4e66  Radeon R300 [Radeon 9700] (Secondary)
+       4e67  Radeon R300 [FireGL X1] (Secondary)
+       4e68  Radeon R350 [Radeon 9800] (Secondary)
        5041  Rage 128 PA/PRO
        5042  Rage 128 PB/PRO AGP 2x
        5043  Rage 128 PC/PRO AGP 4x
        504d  Rage 128 PM/PRO
        504e  Rage 128 PN/PRO AGP 2x
        504f  Rage 128 PO/PRO AGP 4x
-       5050  Rage 128 PP/PRO TMDS
+       5050  Rage 128 PP/PRO TMDS [Xpert 128]
                1002 0008  Xpert 128
        5051  Rage 128 PQ/PRO AGP 2x TMDS
        5052  Rage 128 PR/PRO AGP 4x TMDS
        5056  Rage 128 PV/PRO TMDS
        5057  Rage 128 PW/PRO AGP 2x TMDS
        5058  Rage 128 PX/PRO AGP 4x TMDS
-       5144  Radeon QD
+# Update: This same chip is used in all 32Mb and 64Mb SDR/DDR orig Radeons, and is now known as 7200
+       5144  Radeon R100 QD [Radeon 7200]
                1002 0008  Radeon 7000/Radeon VE
                1002 0009  Radeon 7000/Radeon
                1002 000a  Radeon 7000/Radeon
                1002 028a  Radeon 7000/Radeon
                1002 02aa  Radeon AIW
                1002 053a  Radeon 7000/Radeon
-       5145  Radeon QE
-       5146  Radeon QF
-       5147  Radeon QG
+       5145  Radeon R100 QE
+       5146  Radeon R100 QF
+       5147  Radeon R100 QG
        5148  Radeon R200 QH [Radeon 8500]
-               1002 0152  FireGL 8800
-               1002 0172  FireGL 8700
+               1002 010a  FireGL 8800 64Mb
+               1002 0152  FireGL 8800 128Mb
+               1002 0162  FireGL 8700 32Mb
+               1002 0172  FireGL 8700 64Mb
        5149  Radeon R200 QI
        514a  Radeon R200 QJ
        514b  Radeon R200 QK
        514c  Radeon R200 QL [Radeon 8500 LE]
                1002 003a  Radeon R200 QL [Radeon 8500 LE]
                1002 013a  Radeon 8500
-       5157  Radeon 7500 QW
+               148c 2026  R200 QL [Radeon 8500 Evil Master II Multi Display Edition]
+               174b 7149  Radeon R200 QL [Sapphire Radeon 8500 LE]
+# New: Radeon 9100 is basically a Radeon 8500LE branded as 9100 by Sapphire
+       514d  Radeon R200 QM [Radeon 9100]
+# New: Radeon 8500LE chip
+       514e  Radeon R200 QN [Radeon 8500LE]
+# New: Radeon 8500LE chip
+       514f  Radeon R200 QO [Radeon 8500LE]
+       5157  Radeon RV200 QW [Radeon 7500]
                1002 013a  Radeon 7500
+               1458 4000  RV200 QW [RADEON 7500 PRO MAYA AR]
+               148c 2024  RV200 QW [Radeon 7500LE Dual Display]
+               148c 2025  RV200 QW [Radeon 7500 Evil Master Multi Display Edition]
+               148c 2036  RV200 QW [Radeon 7500 PCI Dual Display]
+               174b 7147  RV200 QW [Sapphire Radeon 7500LE]
                174b 7161  Radeon RV200 QW [Radeon 7500 LE]
-       5158  Radeon 7500 QX
-       5159  Radeon VE QY
+               17af 0202  RV200 QW [Excalibur Radeon 7500LE]
+       5158  Radeon RV200 QX [Radeon 7500]
+# Update: More correct name
+       5159  Radeon RV100 QY [Radeon 7000/VE]
                1002 000a  Radeon 7000/Radeon VE
+               1002 000b  Radeon 7000
                1002 0038  Radeon 7000/Radeon VE
                1002 003a  Radeon 7000/Radeon VE
                1002 00ba  Radeon 7000/Radeon VE
                1002 013a  Radeon 7000/Radeon VE
-               174b 7112  Radeon 7000 64M TVO
-       515a  Radeon VE QZ
+               1458 4002  RV100 QY [RADEON 7000 PRO MAYA AV Series]
+               148c 2003  RV100 QY [Radeon 7000 Multi-Display Edition]
+               148c 2023  RV100 QY [Radeon 7000 Evil Master Multi-Display]
+               174b 7112  RV100 QY [Sapphire Radeon VE 7000]
+               1787 0202  RV100 QY [Excalibur Radeon 7000]
+# Update: More correct name
+       515a  Radeon RV100 QZ [Radeon 7000/VE]
        5168  Radeon R200 Qh
        5169  Radeon R200 Qi
        516a  Radeon R200 Qj
        516b  Radeon R200 Qk
+# new: This one is not in ATI documentation, but is in XFree86 source code
+       516c  Radeon R200 Ql
        5245  Rage 128 RE/SG
                1002 0008  Xpert 128
                1002 0028  Rage 128 AIW
                1002 0088  Xpert 99
        5345  Rage 128 SE/4x
        5346  Rage 128 SF/4x AGP 2x
+               1002 0048  RAGE 128 16MB VGA TVOUT AMC PAL
        5347  Rage 128 SG/4x AGP 4x
        5348  Rage 128 SH
        534b  Rage 128 SK/4x
                1002 5654  Mach64VT Reference
        5655  264VT3 [Mach64 VT3]
        5656  264VT4 [Mach64 VT4]
+       700f  PCI Bridge [IGP 320M]
+       7010  PCI Bridge [IGP 340M]
+       cab2  RS200/RS200M AGP Bridge [IGP 340M]
 1003  ULSI Systems
        0201  US201
 1004  VLSI Technology Inc
                1004 0306  QSound ThunderBird PCI Audio Support Registers
                122d 1208  DSP368 Audio Support Registers
                1483 5022  XWave Thunder 3D Audio Support Registers
+       0307  Thunderbird
+       0308  Thunderbird
        0702  VAS96011 [Golden Gate II]
+       0703  Tollgate
 1005  Avance Logic Inc. [ALI]
        2064  ALG2032/2064
        2128  ALG2364A
        0014  DECchip 21041 [Tulip Pass 3]
                1186 0100  DE-530+
        0016  DGLPB [OPPO]
+       0017  PV-PCI Graphics Controller (ZLXp-L)
        0019  DECchip 21142/43
                1011 500a  DE500A Fast Ethernet
                1011 500b  DE500B Fast Ethernet
                1014 0001  10/100 EtherJet Cardbus
                1025 0315  ALN315 Fast Ethernet
-               1033 800c  PC-9821-CS01
-               1033 800d  PC-9821NR-B06
+               1033 800c  PC-9821-CS01 100BASE-TX Interface Card
+               1033 800d  PC-9821NR-B06 100BASE-TX Interface Card
                108d 0016  Rapidfire 2327 10/100 Ethernet
                108d 0017  GoCard 2250 Ethernet 10/100 Cardbus
                10b8 2005  SMC8032DT Extreme Ethernet 10/100
                1374 0002  Cardbus Ethernet Card 10/100
                1374 0007  Cardbus Ethernet Card 10/100
                1374 0008  Cardbus Ethernet Card 10/100
+               1385 2100  FA510
                1395 0001  10/100 Ethernet CardBus PC Card
                13d1 ab01  EtherFast 10/100 Cardbus (PCMPC200)
                8086 0001  EtherExpress PRO/100 Mobile CardBus 32
                1014 1010  CS4610 SoundFusion Audio Accelerator
        6003  CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator]
                1013 4280  Crystal SoundFusion PCI Audio Accelerator
-               1681 0050  Hercules Game Theater XP
-               1681 a011  Hercules Fortissimo III 7.1
+               1681 0050  Game Theater XP
+               1681 a011  Fortissimo III 7.1
        6004  CS 4614/22/24 [CrystalClear SoundFusion Audio Accelerator]
        6005  Crystal CS4281 PCI Audio
                1013 4281  Crystal CS4281 PCI Audio
        0020  MCA
        0022  IBM27-82351
        002d  Python
-       002e  ServeRAID-3x
+       002e  ServeRAID Controller
+               1014 002e  ServeRAID-3x
+               1014 022e  ServeRAID-4H
        0036  Miami
        003a  CPU to PCI Bridge
        003e  16/4 Token ring UTP/STP controller
        00b7  256-bit Graphics Rasterizer [Fire GL1]
                1902 00b8  Fire GL1
        00be  ATM 622MBPS Controller (1410be00)
+       00dc  Advanced Systems Management Adapter (ASMA)
        00fc  CPC710 Dual Bridge and Memory Controller (PCI-64)
        0105  CPC710 Dual Bridge and Memory Controller (PCI-32)
+       010f  Remote Supervisor Adapter (RSA)
        0142  Yotta Video Compositor Input
                1014 0143  Yotta Input Controller (ytin)
        0144  Yotta Video Compositor Output
                1014 0145  Yotta Output Controller (ytout)
        0156  405GP PLB to PCI Bridge
        01a7  PCI-X to PCI-X Bridge
-       01bd  Netfinity ServeRAID controller
-       01be  ServeRAID-4M
-       01bf  ServeRAID-4L
-       022e  ServeRAID-4H
+       01bd  ServeRAID Controller
+               1014 01be  ServeRAID-4M
+               1014 01bf  ServeRAID-4L
+               1014 0208  ServeRAID-4Mx
+               1014 020e  ServeRAID-4Lx
+               1014 022e  ServeRAID-4H
+               1014 0258  ServeRAID-5i
+               1014 0259  ServeRAID-5i
+       0302  XA-32 chipset [Summit]
        ffff  MPIC-2 interrupt controller
 1015  LSI Logic Corp of Canada
 1016  ICL Personal Systems
 1020  Hitachi Computer Products
 1021  OKI Electric Industry Co. Ltd.
 1022  Advanced Micro Devices [AMD]
-       2000  79c970 [PCnet LANCE]
+       1100  K8 NorthBridge
+       1101  K8 NorthBridge
+       1102  K8 NorthBridge
+       1103  K8 NorthBridge
+       2000  79c970 [PCnet32 LANCE]
                1014 2000  NetFinity 10/100 Fast Ethernet
                103c 104c  Ethernet with LAN remote power Adapter
                103c 1064  Ethernet with LAN remote power Adapter
        7443  AMD-768 [Opus] ACPI
                1043 8044  A7M-D Mainboard
        7445  AMD-768 [Opus] Audio
+       7446  AMD-768 [Opus] MC97 Modem (Smart Link HAMR5600 compatible)
        7448  AMD-768 [Opus] PCI
        7449  AMD-768 [Opus] USB
+       7450  AMD-8131 PCI-X Bridge
+       7451  AMD-8131 PCI-X APIC
        7454  AMD-8151 System Controller
        7455  AMD-8151 AGP Bridge
        7460  AMD-8111 PCI
        7461  AMD-8111 USB
        7462  AMD-8111 Ethernet
+       7464  AMD-8111 USB
        7468  AMD-8111 LPC
        7469  AMD-8111 IDE
        746a  AMD-8111 SMBus 2.0
        746b  AMD-8111 ACPI
        746d  AMD-8111 AC97 Audio
-       756b  AMD-8111 ACPI
+       746e  AMD-8111 MC97 Modem
 1023  Trident Microsystems
        0194  82C194
        2000  4DWave DX
        8520  CyberBlade i1
                0e11 b16e  CyberBlade i1 AGP
                1023 8520  CyberBlade i1 AGP
+       8620  CyberBlade/i1
+               1014 0502  ThinkPad T30
        8820  CyberBlade XPAi1
        9320  TGUI 9320
        9350  GUI Accelerator
                1028 00d0  PowerEdge Expandable RAID Controller 3/Si
        0005  PowerEdge Expandable RAID Controller 3/Di
        0006  PowerEdge Expandable RAID Controller 3/Di
-       0007  Remote Assistant Card 3
-       0008  PowerEdge Expandable RAID Controller 3/Di
+       0007  Remote Access Controller:DRAC III
+       0008  Remote Access Controller
+       0009  BMC/SMIC device not present
        000a  PowerEdge Expandable RAID Controller 3
-               1027 0121  PowerEdge Expandable RAID Controller 3/Di
                1028 0106  PowerEdge Expandable RAID Controller 3/Di
                1028 011b  PowerEdge Expandable RAID Controller 3/Di
-       000c  Embedded Systems Management Device 4
+               1028 0121  PowerEdge Expandable RAID Controller 3/Di
+       000c  Remote Access Controller:ERA or ERA/O
+       000d  BMC/SMIC device
        000e  PowerEdge Expandable RAID Controller
        000f  PowerEdge Expandable RAID Controller 4/Di
 1029  Siemens Nixdorf IS
 102b  Matrox Graphics, Inc.
 # DJ: I've a suspicion that 0010 is a duplicate of 0d10.
        0010  MGA-I [Impression?]
+       0100  MGA 1064SG [Mystique]
        0518  MGA-II [Athena]
        0519  MGA 2064W [Millennium]
        051a  MGA 1064SG [Mystique]
+               102b 0100  MGA-1064SG Mystique
                102b 1100  MGA-1084SG Mystique
                102b 1200  MGA-1084SG Mystique
                1100 102b  MGA-1084SG Mystique
                102b 5f52  4Sight II
                102b 9010  Millennium G400 Dual Head
                1458 0400  GA-G400
-               1705 0001  Digital First Millennium G450 32MB SGRAM
-               1705 0002  Digital First Millennium G450 16MB SGRAM
-               1705 0003  Digital First Millennium G450 32MB
-               1705 0004  Digital First Millennium G450 16MB
+               1705 0001  Millennium G450 32MB SGRAM
+               1705 0002  Millennium G450 16MB SGRAM
+               1705 0003  Millennium G450 32MB
+               1705 0004  Millennium G450 16MB
                b16f 0e11  MGA-G400 AGP
        0527  MGA Parhelia AGP
                102b 0840  Parhelia 128Mb
        0009  r4x00
        0020  ATM Meteor 155
                102f 00f8  ATM Meteor 155
+       0180  TX4927
 1030  TMC Research
 1031  Miro Computer Products AG
        5601  DC20 ASIC
        0003  ATM Controller
        0004  R4000 PCI Bridge
        0005  PCI to 486-like bus Bridge
-       0006  GUI Accelerator
+       0006  PC-9800 Graphic Accelerator
        0007  PCI to UX-Bus Bridge
-       0008  GUI Accelerator
-       0009  GUI Accelerator for W98
+       0008  PC-9800 Graphic Accelerator
+       0009  PCI to PC9800 Core-Graph Bridge
+       0016  PCI to VL Bridge
        001a  [Nile II]
        0021  Vrc4373 [Nile I]
        0029  PowerVR PCX1
        002a  PowerVR 3D
+       002c  Star Alpha 2
+       002d  PCI to C-bus Bridge
        0035  USB
                1179 0001  USB
                12ee 7000  Root Hub
+               1799 0001  Root Hub
+       003b  PCI to C-bus Bridge
        003e  NAPCCARD Cardbus Controller
        0046  PowerVR PCX2 [midas]
        005a  Vrc5074 [Nile 4]
        0074  56k Voice Modem
                1033 8014  RCV56ACF 56k Voice Modem
        009b  Vrc5476
+       00a5  VRC4173
        00a6  VRC5477 AC97
        00cd  IEEE 1394 [OrangeLink] Host Controller
                12ee 8011  Root hub
        00e0  USB 2.0
                12ee 7001  Root hub
+               1799 0002  Root Hub
 1034  Framatome Connectors USA Inc.
 1035  Comp. & Comm. Research Lab
 1036  Future Domain Corp.
 1037  Hitachi Micro Systems
 1038  AMP, Inc
 1039  Silicon Integrated Systems [SiS]
-       0001  5591/5592 AGP
+# This is what all my tests report. I don't know if this is equivalent to "5591/5592 AGP".
+       0001  SiS 530 Virtual PCI-to-PCI bridge (AGP)
        0002  SG86C202
        0006  85C501/2/3
        0008  85C503/5513
                1039 0000  SiS5597 SVGA (Shared RAM)
        0204  82C204
        0205  SG86C205
-       0300  300/200
+       0300  SiS300/305 PCI/AGP VGA Display Adapter
                107d 2720  Leadtek WinFast VR300
+       0310  SiS315H PCI/AGP VGA Display Adapter
+       0315  SiS315 PCI/AGP VGA Display Adapter
+       0325  SiS315PRO PCI/AGP VGA Display Adapter
+       0330  SiS330 [Xabre] PCI/AGP VGA Display Adapter
        0406  85C501/2
        0496  85C496
        0530  530 Host
        0630  630 Host
        0633  633 Host
        0635  635 Host
-       0645  645 Host
-       0646  645DX Host
+       0645  SiS645 Host & Memory & AGP Controller
+       0646  SiS645DX Host & Memory & AGP Controller
+       0648  SiS 645xx
        0650  650 Host
+       0651  SiS651 Host
        0730  730 Host
        0733  733 Host
        0735  735 Host
        0740  740 Host
        0745  745 Host
+       0746  746 Host
+       0755  SiS 755 Host Bridge
        0900  SiS900 10/100 Ethernet
                1039 0900  SiS900 10/100 Ethernet Adapter
        0961  SiS961 [MuTIOL Media IO]
+       0962  SiS962 [MuTIOL Media IO]
        3602  83C602
        5107  5107
        5300  SiS540 PCI Display Adapter
+       5315  SiS550 AGP/VGA VGA Display Adapter
        5401  486 PCI Chipset
        5511  5511/5512
        5513  5513 [IDE]
+               1019 0970  P6STP-FL motherboard
                1039 5513  SiS5513 EIDE Controller (A,B step)
        5517  5517
        5571  5571
        6205  VGA Controller
        6236  6236 3D-AGP
        6300  SiS630 GUI Accelerator+3D
-       6306  6306 3D-AGP
+               1019 0970  P6STP-FL motherboard
+       6306  SiS530 3D PCI/AGP
                1039 6306  SiS530,620 GUI Accelerator+3D
+       6325  SiS65x/M650/740 PCI/AGP VGA Display Adapter
        6326  86C326 5598/6326
                1039 6326  SiS6326 GUI Accelerator
                1092 0a50  SpeedStar A50
                1092 4910  SpeedStar A70
                1092 4920  SpeedStar A70
                1569 6326  SiS6326 GUI Accelerator
-       7001  7001
+       7001  USB 1.0 Controller
+               1039 7000  Onboard USB Controller
+       7002  USB 2.0 Controller
+               1509 7002  Onboard USB Controller
        7007  FireWire Controller
-       7012  SiS7012 PCI Audio Accelerator
-       7013  56k Winmodem (Smart Link HAMR5600 compatible)
-       7016  SiS7016 10/100 Ethernet Adapter
+       7012  Sound Controller
+       7013  Intel 537 [56k Winmodem]
+       7016  10/100 Ethernet Adapter
                1039 7016  SiS7016 10/100 Ethernet Adapter
        7018  SiS PCI Audio Accelerator
                1014 01b6  SiS PCI Audio Accelerator
                103c 1226  Keystone SP2
                103c 1227  Powerbar SP2
                103c 1282  Everest SP2
+       1054  PCI Local Bus Adapter
        1064  79C970 PCnet Ethernet Controller
        108b  Visualize FXe
        10c1  NetServer Smart IRQ Router
        121c  NetServer PCI COM Port Decoder
        1229  zx1 System Bus Adapter
        122a  zx1 I/O Controller
-       122e  zx1 Local Bus Adapter
+       122e  PCI-X/AGP Local Bus Adapter
+       127c  sx1000 I/O Controller
        1290  Auxiliary Diva Serial Port
        2910  E2910A PCIBus Exerciser
        2925  E2925A 32 Bit, 33 MHzPCI Exerciser & Analyzer
 1040  Accelgraphics Inc.
 1041  Computrend
 1042  Micron
-       1000  FDC 37C665
-       1001  37C922
+       1000  PC Tech RZ1000
+       1001  PC Tech RZ1001
        3000  Samurai_0
        3010  Samurai_1
        3020  Samurai_IDE
 1043  Asustek Computer, Inc.
        0675  ISDNLink P-IN100-ST-D
+       4021  v7100 Combo Deluxe [GeForce2 MX + TV tuner]
        4057  V8200 GeForce 3
 1044  Distributed Processing Technology
        1012  Domino RAID Engine
 104a  SGS Thomson Microelectronics
        0008  STG 2000X
        0009  STG 1764X
+       0010  STG4000 [3D Prophet Kyro Series]
+# From <http://gatekeeper.dec.com/pub/BSD/FreeBSD/FreeBSD-stable/src/share/misc/pci_vendors>
+       0210  STPC Atlas ISA Bridge
        0981  DEC-Tulip compatible 10/100 Ethernet
        1746  STG 1764X
        2774  DEC-Tulip compatible 10/100 Ethernet
        0500  100 MBit LAN Controller
        0508  TMS380C2X Compressor Interface
        1000  Eagle i/f AS
+       104c  PCI1510 PC card Cardbus Controller
        3d04  TVP4010 [Permedia]
        3d07  TVP4020 [Permedia 2]
                1011 4d10  Comet
        8026  TSB43AB21 IEEE-1394a-2000 Controller (PHY/Link)
        8027  PCI4451 IEEE-1394 Controller
                1028 00e6  PCI4451 IEEE-1394 Controller (Dell Inspiron 8100)
+       8029  PCI4510 IEEE-1394 Controller
+       8400  ACX 100 22Mbps Wireless Interface
        a001  TDC1570
        a100  TDC1561
        a102  TNETA1575 HyperSAR Plus w/PCI Host i/f & UTOPIA i/f
+       a106  TMS320C6205
        ac10  PCI1050
        ac11  PCI1053
        ac12  PCI1130
        ac19  PCI1221
        ac1a  PCI1210
        ac1b  PCI1450
+               0e11 b113  Armada M700
        ac1c  PCI1225
        ac1d  PCI1251A
        ac1e  PCI1211
        ac41  PCI4410 PC card Cardbus Controller
        ac42  PCI4451 PC card Cardbus Controller
                1028 00e6  PCI4451 PC card CardBus Controller (Dell Inspiron 8100)
+       ac44  PCI4510 PC card Cardbus Controller
        ac50  PCI1410 PC card Cardbus Controller
        ac51  PCI1420
                1014 023b  ThinkPad T23 (2647-4MG)
        ac52  PCI1451 PC card Cardbus Controller
        ac53  PCI1421 PC card Cardbus Controller
        ac55  PCI1250 PC card Cardbus Controller
+               1014 0512  ThinkPad T30
+       ac56  PCI1510 PC card Cardbus Controller
        ac60  PCI2040 PCI to DSP Bridge Controller
        fe00  FireWire Host Controller
        fe03  12C01A FireWire Host Controller
                1050 0840  W89C840 Ethernet Adapter
        0940  W89C940
        5a5a  W89C940F
+       6692  W6692
        9970  W9970CF
 1051  Anigma, Inc.
 1052  ?Young Micro Systems
        0001  MPC105 [Eagle]
        0002  MPC106 [Grackle]
        0003  MPC8240 [Kahlua]
+       0004  MPC107
+       0006  MPC8245 [Unity]
        0100  MC145575 [HFC-PCI]
        0431  KTI829c 100VG
        1801  Audio I/O Controller (MIDI)
        0d38  20263
                105a 4d39  Fasttrak66
        1275  20275
+       3376  PDC20376
+               1043 809e  A7V8X motherboard
        4d30  20267
                105a 4d33  Ultra100
                105a 4d39  Fasttrak100
        4d68  20268
                105a 4d68  Ultra100TX2
        4d69  20269
+               105a 4d68  Ultra133TX2
        5275  PDC20276 IDE
                105a 0275  SuperTrak SX6000 IDE
        5300  DC5300
        6268  20268R
        6269  PDC20271
-               105a 6269  Fasttrack tx2
+               105a 6269  FastTrak TX2/TX2000
+       6621  PDC20621 [SX4000] 4 Channel IDE RAID Controller
        7275  PDC20277
 105b  Foxconn International, Inc.
 105c  Wipro Infotech Limited
                13cc 0009  Barco Metheus 5 Megapixel, Dual Head
                13cc 000a  Barco Metheus 5 Megapixel, Dual Head
        5348  Revolution 4
+               105d 0037  Revolution IV-FP AGP (For SGI 1600SW)
 105e  Vtech Computers Ltd
 105f  Infotronic America Inc
 1060  United Microelectronics [UMC]
        002e  UniNorth 1.5 PCI
        002f  UniNorth 1.5 Internal PCI
        0030  UniNorth/Pangea FireWire
+       0031  UniNorth 2 FireWire
+       0032  UniNorth 2 GMAC (Sun GEM)
+       0033  UniNorth 2 ATA/100
+       0034  UniNorth 2 AGP
+       1645  Tigon3 Gigabit Ethernet NIC (BCM5701)
 106c  Hyundai Electronics America
        8801  Dual Pentium ISA/PCI Motherboard
        8802  PowerPC ISA/PCI Motherboard
        2100  QLA2100 64-bit Fibre Channel Adapter
                1077 0001  QLA2100 64-bit Fibre Channel Adapter
        2200  QLA2200
+               1077 0002  QLA2200
        2300  QLA2300 64-bit FC-AL Adapter
        2312  QLA2312 Fibre Channel Adapter
 1078  Cyrix Corporation
 1087  Cache Computer
 1088  Microcomputer Systems (M) Son
 1089  Data General Corporation
-108a  SBS Technologies (formerly Bit3 Computer Corp.)
+# Formerly Bit3 Computer Corp.
+108a  SBS Technologies
        0001  VME Bridge Model 617
        0010  VME Bridge Model 618
        0040  dataBLIZZARD
        8001  Schizo PCI Bus Module
        a000  Ultra IIi
        a001  Ultra IIe
+       a801  Tomatillo PCI Bus Module
 108f  Systemsoft
 1090  Encore Computer Corporation
 1091  Intergraph Corporation
        b081  IMAQ-PXI-1422
        b091  IMAQ-PXI-1411
        c801  PCI-GPIB
+       c831  PCI-GPIB bridge
 1094  First International Computers [FIC]
 1095  CMD Technology Inc
+       0240  Adaptec AAR-1210SA SATA HostRAID Controller
        0640  PCI0640
        0643  PCI0643
        0646  PCI0646
                1095 0670  USB0670
        0673  USB0673
        0680  PCI0680
+       3112  Silicon Image SiI 3112 SATARaid Controller
 1096  Alacron
 1097  Appian Technology
 1098  Quantum Designs (H.K.) Ltd
        036c  Bt879(??) Video Capture
                13e9 0070  Win/TV (Video Section)
        036e  Bt878 Video Capture
-               0070 13eb  WinTV/GO
+               0070 13eb  WinTV Series
                0070 ff01  Viewcast Osprey 200
+               107d 6606  WinFast TV 2000
+               11bd 0012  PCTV pro (TV + FM stereo receiver)
                11bd 001c  PCTV Sat (DBC receiver)
                127a 0001  Bt878 Mediastream Controller NTSC
                127a 0002  Bt878 Mediastream Controller PAL BG
                1851 1850  FlyVideo'98 - Video
                1851 1851  FlyVideo II
                1852 1852  FlyVideo'98 - Video (with FM Tuner)
+               bd11 1200  PCTV pro (TV + FM stereo receiver)
        036f  Bt879 Video Capture
                127a 0044  Bt879 Video Capture NTSC
                127a 0122  Bt879 Video Capture PAL I
                1851 1851  FlyVideo'98 EZ - video
                1852 1852  FlyVideo'98 (with FM Tuner)
        0878  Bt878 Audio Capture
-               0070 13eb  WinTV/GO
+               0070 13eb  WinTV Series
                0070 ff01  Viewcast Osprey 200
                1002 0001  TV-Wonder
                1002 0003  TV-Wonder/VE
+               11bd 0012  PCTV pro (TV + FM stereo receiver, audio section)
                11bd 001c  PCTV Sat (DBC receiver)
                127a 0001  Bt878 Video Capture (Audio Section)
                127a 0002  Bt878 Video Capture (Audio Section)
                14f1 0002  Bt878 Video Capture (Audio Section)
                14f1 0003  Bt878 Video Capture (Audio Section)
                14f1 0048  Bt878 Video Capture (Audio Section)
+               bd11 1200  PCTV pro (TV + FM stereo receiver, audio section)
        0879  Bt879 Audio Capture
                127a 0044  Bt879 Video Capture (Audio Section)
                127a 0122  Bt879 Video Capture (Audio Section)
 10a2  Quantum Corporation
 10a3  Everex Systems Inc
 10a4  Globe Manufacturing Sales
-10a5  Racal Interlan
+10a5  Smart Link Ltd.
+       3052  SmartPCI562 56K Modem
+       5449  SmartPCI561 modem
 10a6  Informtech Industrial Ltd.
 10a7  Benchmarq Microelectronics
 10a8  Sierra Semiconductor
        0007  RPCEX
        0008  DiVO VIP
        0009  Alteon Gigabit Ethernet
+               10a9 8002  Acenic Gigabit Ethernet
        0010  AMP Video I/O
        0011  GRIP
        0012  SGH PSHAC GSN
        1006  Dual JPEG 4
        1007  Dual JPEG 5
        1008  Cesium
+       100a  IOC4 I/O controller
        2001  Fibre Channel
        2002  ASDE
        8001  O2 1394
                15ed 1003  MCCS 16-port Serial Hot Swap
        9036  9036
        9050  PCI <-> IOBus Bridge
+               10b5 2036  SatPak GPS
                10b5 2273  SH-ARC SoHard ARCnet card
+               10b5 9050  MP9050
                1522 0001  RockForce 4 Port V.90 Data/Fax/Voice Modem
                1522 0002  RockForce 2 Port V.90 Data/Fax/Voice Modem
                1522 0003  RockForce 6 Port V.90 Data/Fax/Voice Modem
                15ed 1001  Macrolink MCCS 16-port Serial
                15ed 1002  Macrolink MCCS 8-port Serial Hot Swap
                15ed 1003  Macrolink MCCS 16-port Serial Hot Swap
+               5654 5634  OpenLine4 Telephony Card
                d531 c002  PCIntelliCAN 2xSJA1000 CAN bus
                d84d 4006  EX-4006 1P
                d84d 4008  EX-4008 1P EPP/ECP
                d84d 4078  EX-4078 2S(16C552) RS-232+1P
        9054  PCI <-> IOBus Bridge
                10b5 2455  Wessex Techology PHIL-PCI
+               12d9 0002  PCI Prosody Card rev 1.5
        9060  9060
        906d  9060SD
                125c 0640  Aries 16000P
        9080  9080
                10b5 9080  9080 [real subsystem ID not set]
                129d 0002  Aculab PCI Prosidy card
-       a001  GTEK Jetport II 2 port serial adaptor
-       c001  GTEK Cyclone 16/32 port serial adaptor
+               12d9 0002  PCI Prosody Card
 10b6  Madge Networks
        0001  Smart 16/4 PCI Ringnode
        0002  Smart 16/4 PCI Ringnode Mk2
        1001  Collage 155 ATM Server Adapter
 10b7  3Com Corporation
        0001  3c985 1000BaseSX (SX/TX)
+       0910  3C910-A01
        1006  MINI PCI type 3B Data Fax Modem
        1007  Mini PCI 56k Winmodem
                10b7 615c  Mini PCI 56K Modem
+       1700  Gigabit Ethernet Adapter
+               10b7 0010  3Com 3C940 Gigabit LOM Ethernet Adapter
+               10b7 0020  3Com 3C941 Gigabit LOM Ethernet Adapter
        3390  3c339 TokenLink Velocity
        3590  3c359 TokenLink Velocity XL
                10b7 3590  TokenLink Velocity XL Adapter (3C359/359B)
                1028 0095  Integrated 3C905C-TX Fast Etherlink for PC Management NIC
                10b7 1000  3C905C-TX Fast Etherlink for PC Management NIC
                10b7 7000  10/100 Mini PCI Ethernet Adapter
+       9201  3C920B-EMB Integrated Fast Ethernet Controller
+       9300  3CSOHO100B-TX  [910-A01]
        9800  3c980-TX [Fast Etherlink XL Server Adapter]
                10b7 9800  3c980-TX Fast Etherlink XL Server Adapter
        9805  3c980-TX 10/100baseTX NIC [Python-T]
                10b7 1201  3c982-TXM 10/100baseTX Dual Port A [Hydra]
                10b7 1202  3c982-TXM 10/100baseTX Dual Port B [Hydra]
                10b7 9805  3c980 10/100baseTX NIC [Python-T]
-       9900  3C990-TX Typhoon
-       9902  3CR990-TX-95 56-bit Typhoon Client
-       9903  3CR990-TX-97 168-bit Typhoon Client
+               10f1 2462  Thunder K7 S2462
+       9900  3C990-TX [Typhoon]
+       9902  3CR990-TX-95 [Typhoon 56-bit]
+       9903  3CR990-TX-97 [Typhoon 168-bit]
        9904  3C990B-TX-M/3C990BSVR [Typhoon2]
+               10b7 1000  3CR990B-TX-M [Typhoon2]
+               10b7 2000  3CR990BSVR [Typhoon2 Server]
        9905  3CR990-FX-95/97/95 [Typhon Fiber]
-       9908  3CR990SVR95 56-bit Typhoon Server
-       9909  3CR990SVR97 Typhoon Server
+               10b7 1101  3CR990-FX-95 [Typhoon Fiber 56-bit]
+               10b7 1102  3CR990-FX-97 [Typhoon Fiber 168-bit]
+               10b7 2101  3CR990-FX-95 Server [Typhoon Fiber 56-bit]
+               10b7 2102  3CR990-FX-97 Server [Typhoon Fiber 168-bit]
+       9908  3CR990SVR95 [Typhoon Server 56-bit]
+       9909  3CR990SVR97 [Typhoon Server 168-bit]
        990b  3C990SVR [Typhoon Server]
 10b8  Standard Microsystems Corp [SMC]
        0005  83C170QF
        1001  FDC 37C922
        a011  83C170QF
        b106  SMC34C90
-10b9  Acer Laboratories Inc. [ALi]
+10b9  ALi Corporation
        0111  C-Media CMI8738/C3DX Audio Device (OEM)
                10b9 0111  C-Media CMI8738/C3DX Audio Device (OEM)
        1435  M1435
        1541  M1541
                10b9 1541  ALI M1541 Aladdin V/V+ AGP System Controller
        1543  M1543
+       1563  M1563 HyperTransport South Bridge
        1621  M1621
        1631  ALI M1631 PCI North Bridge Aladdin Pro III
        1632  M1632M Northbridge+Trident
        1646  M1646 Northbridge+Trident
        1647  M1647 Northbridge [MAGiK 1 / MobileMAGiK 1]
        1651  M1651/M1651T Northbridge [Aladdin-Pro 5/5M,Aladdin-Pro 5T/5TM]
-       1671  M1671 Northbridge [Aladdin-P4]
+       1671  M1671 Super P4 Northbridge [AGP4X,PCI and SDR/DDR]
+       1681  M1681 P4 Northbridge [AGP8X,HyperTransport and SDR/DDR]
+       1687  M1687 K8 Northbridge [AGP8X and HyperTransport]
        3141  M3141
        3143  M3143
        3145  M3145
        5239  USB 2.0 Controller
        5243  M1541 PCI to AGP Controller
        5247  PCI to AGP Controller
+       5249  M5249 HTT to PCI Bridge
        5251  M5251 P1394 OHCI 1.0 Controller
        5253  M5253 P1394 OHCI 1.1 Controller
        5261  M5261 Ethernet Controller
+       5450  Lucent Technologies Soft Modem AMR
        5451  M5451 PCI AC-Link Controller Audio Device
+               1014 0506  ThinkPad R30
        5453  M5453 PCI AC-Link Controller Modem Device
        5455  M5455 PCI AC-Link Controller Audio Device
-       5457  M5457 AC-Link Modem Interface Controller
+       5457  Intel 537 [M5457 AC-Link Modem]
+# Same but more usefull for driver's lookup
+       5459  SmartLink SmartPCI561 56K Modem
+# SmartLink PCI SoftModem
+       545a  SmartLink SmartPCI563 56K Modem
        5471  M5471 Memory Stick Controller
        5473  M5473 SD-MMC Controller
        7101  M7101 PMU
 10c6  Rambus Inc.
 10c7  Media Vision
 10c8  Neomagic Corporation
-       0001  NM2070 [MagicGraph NM2070]
+       0001  NM2070 [MagicGraph 128]
        0002  NM2090 [MagicGraph 128V]
        0003  NM2093 [MagicGraph 128ZV]
        0004  NM2160 [MagicGraph 128XD]
                10f7 830b  MagicGraph 128XD
                10f7 830d  MagicGraph 128XD
                10f7 8312  MagicGraph 128XD
-       0005  [MagicMedia 256AV]
+       0005  NM2200 [MagicGraph 256AV]
+               1014 00dd  ThinkPad 570
        0006  NM2360 [MagicMedia 256ZX]
        0016  NM2380 [MagicMedia 256XL+]
                10c8 0016  MagicMedia 256XL+
-       0025  [MagicMedia 256AV+]
-       0083  [MagicGraph 128ZV Plus]
-       8005  [MagicMedia 256AV Audio]
+       0025  NM2230 [MagicGraph 256AV+]
+       0083  NM2093 [MagicGraph 128ZV+]
+       8005  NM2200 [MagicMedia 256AV Audio]
                0e11 b0d1  MagicMedia 256AV Audio Device on Discovery
                0e11 b126  MagicMedia 256AV Audio Device on Durango
                1014 00dd  MagicMedia 256AV Audio Device on BlackTip Thinkpad
                110a 8005  MagicMedia 256AV Audio Device
                14c0 0004  MagicMedia 256AV Audio Device
        8006  NM2360 [MagicMedia 256ZX Audio]
-       8016  NM2360 [MagicMedia 256ZX Audio]
+       8016  NM2380 [MagicMedia 256XL+ Audio]
 10c9  Dataexpert Corporation
 10ca  Fujitsu Microelectr., Inc.
 10cb  Omron Corporation
        0008  NV1 [EDGE 3D]
        0009  NV1 [EDGE 3D]
        0010  NV2 [Mutara V08]
-       0020  NV4 [Riva TnT]
+       0020  NV4 [RIVA TNT]
                1043 0200  V3400 TNT
                1048 0c18  Erazor II SGRAM
                1048 0c1b  Erazor II
                1092 4914  Viper V550
                1092 8225  Viper V550
                10b4 273d  Velocity 4400
+               10b4 273e  Velocity 4400
                10b4 2740  Velocity 4400
                10de 0020  Riva TNT
                1102 1015  Graphics Blaster CT6710
                1102 1016  Graphics Blaster RIVA TNT
-       0028  NV5 [Riva TnT2]
+       0028  NV5 [RIVA TNT2/TNT2 Pro]
                1043 0200  AGP-V3800 SGRAM
                1043 0201  AGP-V3800 SDRAM
                1043 0205  PCI-V3800
                1043 4000  AGP-V3800PRO
+               1048 0c21  Synergy II
                1092 4804  Viper V770
                1092 4a00  Viper V770
                1092 4a02  Viper V770 Ultra
                1102 1020  3D Blaster RIVA TNT2
                1102 1026  3D Blaster RIVA TNT2 Digital
                14af 5810  Maxi Gamer Xentor
-       0029  NV5 [Riva TnT2 Ultra]
+       0029  NV5 [RIVA TNT2 Ultra]
                1043 0200  AGP-V3800 Deluxe
                1043 0201  AGP-V3800 Ultra SDRAM
                1043 0205  PCI-V3800 Ultra
                14af 5820  Maxi Gamer Xentor 32
        002a  NV5 [Riva TnT2]
        002b  NV5 [Riva TnT2]
-       002c  NV6 [Vanta]
+       002c  NV6 [Vanta/Vanta LT]
                1043 0200  AGP-V3800 Combat SDRAM
                1043 0201  AGP-V3800 Combat
                1092 6820  Viper V730
                1102 1031  CT6938 VANTA 8MB
                1102 1034  CT6894 VANTA 16MB
                14af 5008  Maxi Gamer Phoenix 2
-       002d  RIVA TNT2 Model 64
+       002d  NV5M64 [RIVA TNT2 Model 64/Model 64 Pro]
                1043 0200  AGP-V3800M
                1043 0201  AGP-V3800M
+               1048 0c3a  Erazor III LT
+               10de 001e  M64 AGP4x
                1102 1023  CT6892 RIVA TNT2 Value
                1102 1024  CT6932 RIVA TNT2 Value 32Mb
                1102 102c  CT6931 RIVA TNT2 Value [Jumper]
                1554 1041  PixelView RIVA TNT2 M64 32MB
        002e  NV6 [Vanta]
        002f  NV6 [Vanta]
-       00a0  NV5 [Riva TNT2]
+       0060  nForce2 ISA Bridge
+               1043 80ad  A7N8X Mainboard
+       0064  nForce2 SMBus (MCP)
+       0065  nForce2 IDE
+       0066  nForce2 Ethernet Controller
+       0067  nForce2 USB Controller
+               1043 0c11  A7N8X Mainboard
+       0068  nForce2 USB Controller
+               1043 0c11  A7N8X Mainboard
+       006a  nForce2 AC97 Audio Controler (MCP)
+       006b  nForce MultiMedia audio [Via VT82C686B]
+       006e  nForce2 FireWire (IEEE 1394) Controller
+       00a0  NV5 [Aladdin TNT2]
                14af 5810  Maxi Gamer Xentor
        0100  NV10 [GeForce 256 SDR]
                1043 0200  AGP-V6600 SGRAM
                1043 4009  AGP-V6600 SDRAM
                1102 102d  CT6941 GeForce 256
                14af 5022  3D Prophet SE
-       0101  NV10 [GeForce 256 DDR]
+       0101  NV10DDR [GeForce 256 DDR]
                1043 0202  AGP-V6800 DDR
                1043 400a  AGP-V6800 DDR SGRAM
                1043 400b  AGP-V6800 DDR SDRAM
                1102 102e  CT6971 GeForce 256 DDR
                14af 5021  3D Prophet DDR-DVI
-       0103  NV10 [Quadro]
-       0110  NV11 [GeForce2 MX]
+       0103  NV10GL [Quadro]
+       0110  NV11 [GeForce2 MX/MX 400]
                1043 4015  AGP-V7100 Pro
                1043 4031  V7100 Pro with TV output
+               1462 8817  MSI GeForce2 MX400 Pro32S [MS-8817]
+               14af 7102  3D Prophet II MX
                14af 7103  3D Prophet II MX Dual-Display
-       0111  NV11 [GeForce2 MX DDR]
+       0111  NV11DDR [GeForce2 MX 100 DDR/200 DDR]
        0112  NV11 [GeForce2 Go]
-       0113  NV11 [GeForce2 MXR]
-       0150  NV15 [GeForce2 GTS]
+       0113  NV11GL [Quadro2 MXR/EX]
+       0150  NV15 [GeForce2 GTS/Pro]
                1043 4016  V7700 AGP Video Card
                107d 2840  WinFast GeForce2 GTS with TV output
                1462 8831  Creative GeForce2 Pro
-       0151  NV15 [GeForce2 Ti]
-       0152  NV15 [GeForce2 Ultra, Bladerunner]
+       0151  NV15DDR [GeForce2 Ti]
+               1043 405f  V7700Ti
+       0152  NV15BR [GeForce2 Ultra, Bladerunner]
                1048 0c56  GLADIAC Ultra
-       0153  NV15 [Quadro2 Pro]
-       0170  NV17 [GeForce4 MX460]
-       0171  NV17 [GeForce4 MX440]
-       0172  NV17 [GeForce4 MX420]
-       0173  NV1x
+       0153  NV15GL [Quadro2 Pro]
+       0170  NV17 [GeForce4 MX 460]
+       0171  NV17 [GeForce4 MX 440]
+               10b0 0002  Gainward Pro/600 TV
+               1462 8661  G4MX440-VTP
+               1462 8730  MX440SES-T (MS-8873)
+               147b 8f00  Abit Siluro GeForce4MX440
+       0172  NV17 [GeForce4 MX 420]
+       0173  NV17 [GeForce4 MX 440-SE]
        0174  NV17 [GeForce4 440 Go]
        0175  NV17 [GeForce4 420 Go]
        0176  NV17 [GeForce4 420 Go 32M]
-       0178  Quadro4 500XGL
+       0178  NV17GL [Quadro4 550 XGL]
        0179  NV17 [GeForce4 440 Go 64M]
-       017a  Quadro4 200/400NVS
-       017b  Quadro4 550XGL
-       017c  Quadro4 550 GoGL
+       017a  NV17GL [Quadro4 200/400 NVS]
+       017b  NV17GL [Quadro4 550 XGL]
+       017c  NV17GL [Quadro4 550 GoGL]
+       0181  NV18 [GeForce4 MX 440 AGP 8x]
+       0182  NV18 [GeForce4 MX 440SE AGP 8x]
+       0183  NV18 [GeForce4 MX 420 AGP 8x]
+       0188  NV18GL [Quadro4 580 XGL]
+       018a  NV18GL [Quadro4 NVS]
+       018b  NV18GL [Quadro4 380 XGL]
        01a0  NV15 [GeForce2 - nForce GPU]
        01a4  nForce CPU bridge
        01ab  nForce 420 Memory Controller (DDR)
        01b7  nForce AGP to PCI Bridge
        01b8  nForce PCI-to-PCI bridge
        01bc  nForce IDE
+       01c1  Intel 537 [nForce MC97 Modem]
+       01c2  nForce USB Controller
+       01c3  nForce Ethernet Controller
+       01e8  nForce2 AGP
+       01f0  NV18 [GeForce4 MX - nForce GPU]
        0200  NV20 [GeForce3]
                1043 402f  AGP-V8200 DDR
-       0201  NV20 [GeForce3 Ti200]
-       0202  NV20 [GeForce3 Ti500]
+       0201  NV20 [GeForce3 Ti 200]
+       0202  NV20 [GeForce3 Ti 500]
                1043 405b  V8200 T5
-       0203  NV20 [Quadro DCC]
-       0250  NV25 [GeForce4 Ti4600]
-       0251  NV25 [GeForce4 Ti4400]
-       0253  NV25 [GeForce4 Ti4200]
-       0258  Quadro4 900XGL
-       0259  Quadro4 750XGL
-       025b  Quadro4 700XGL
+               1545 002f  Xtasy 6964
+       0203  NV20DCC [Quadro DCC]
+       0250  NV25 [GeForce4 Ti 4600]
+       0251  NV25 [GeForce4 Ti 4400]
+       0252  NV25 [GeForce4 Ti]
+       0253  NV25 [GeForce4 Ti 4200]
+               107d 2896  WinFast A250 LE TD (Dual VGA/TV-out/DVI)
+               147b 8f09  Siluro (Dual VGA/TV-out/DVI)
+       0258  NV25GL [Quadro4 900 XGL]
+       0259  NV25GL [Quadro4 750 XGL]
+       025b  NV25GL [Quadro4 700 XGL]
+       0280  NV28 [GeForce4 Ti 4800]
+       0281  NV28 [GeForce4 Ti 4200 AGP 8x]
+       0282  NV28 [GeForce4 Ti 4800 SE]
+       0286  NV28 [GeForce4 Ti 4200 Go AGP 8x]
+       0288  NV28GL [Quadro4 980 XGL]
+       0289  NV28GL [Quadro4 780 XGL]
+       0300  NV30 [GeForce FX]
+       0301  NV30 [GeForce FX 5800 Ultra]
+       0302  NV30 [GeForce FX 5800]
+       0308  NV30GL [Quadro FX 2000]
+       0309  NV30GL [Quadro FX 1000]
 10df  Emulex Corporation
-       10df  Light Pulse Fibre Channel Adapter
        1ae5  LP6000 Fibre Channel Host Adapter
+       f085  LP850 Fibre Channel Adapter
+       f095  LP952 Fibre Channel Adapter
+       f098  LP982 Fibre Channel Adapter
        f700  LP7000 Fibre Channel Host Adapter
        f800  LP8000 Fibre Channel Host Adapter
        f900  LP9000 Fibre Channel Host Adapter
+       f980  LP9802 Fibre Channel Adapter
 10e0  Integrated Micro Solutions Inc.
        5026  IMS5026/27/28
        5027  IMS5027
        5028  IMS5028
        8849  IMS8849
        8853  IMS8853
-       9128  IMS9129 [Twin turbo 128]
+       9128  IMS9128 [Twin turbo 128]
 10e1  Tekram Technology Co.,Ltd.
        0391  TRM-S1040
                10e1 0391  DC-315U SCSI-3 Host Adapter
 10e3  Tundra Semiconductor Corp.
        0000  CA91C042 [Universe]
        0860  CA91C860 [QSpan]
+       0862  CA91C862A [QSpan-II]
 10e4  Tandem Computers
 10e5  Micro Industries Corporation
 10e6  Gainbery Computer Products Inc.
        2010  CyberPro 2000A
        5000  CyberPro 5000
        5050  CyberPro 5050
+       5202  CyberPro 5202
 10eb  Artists Graphics
        0101  3GA
        8111  Twist3 Frame Grabber
                1186 1300  DFE-538TX
                1186 1320  SN5200
                1186 8139  DRN-32TX
+               11f6 8139  FN22-3(A) LinxPRO Ethernet Adapter
                1259 2500  AT-2500TX
                1259 2503  AT-2500TX/ACPI
                1429 d010  ND010
                8e2e 7100  KF-230TX/2
                a0a0 0007  ALN-325C
        8169  RTL-8169
+               1371 434e  ProG-2000L
+       8197  SmartLAN56 56K Modem
 10ed  Ascii Corporation
        7310  V7310
-10ee  Xilinx, Inc.
+10ee  Xilinx Corporation
        3fc0  RME Digi96
        3fc1  RME Digi96/8
        3fc2  RME Digi96/8 Pro
 10fa  Truevision
        000c  TARGA 1000
 10fb  Thesys Gesellschaft für Mikroelektronik mbH
+       186f  TH 6255
 10fc  I-O Data Device, Inc.
 # What's in the cardbus end of a Sony ACR-A01 card, comes with newer Vaio CD-RW drives
        0003  Cardbus IDE Controller
                1102 8040  CT4760 SBLive!
                1102 8051  CT4850 SBLive! Value
                1102 8061  SBLive! Player 5.1
+               1102 8064  SB Live! 5.1 Model SB0100
+               1102 8065  SBLive! 5.1 Digital Model SB0220
        0004  SB Audigy
                1102 0051  SB0090 Audigy Player
+               1102 0053  SB0090 Audigy Player/OEM
+       0006  [SB Live! Value] EMU10k1X
        4001  SB Audigy FireWire Port
+               1102 0010  SB Audigy FireWire Port
        7002  SB Live! MIDI/Game Port
                1102 0020  Gameport Joystick
        7003  SB Audigy MIDI/Game port
-               1102 0040  SB Audigy MIDI/Gameport
-       8938  ES1371
+               1102 0040  SB Audigy MIDI/Game Port
+       7004  [SB Live! Value] Input device controller
+       8064  SB0100 [SBLive! 5.1 OEM]
+       8938  Ectiva EV1938
 1103  Triones Technologies, Inc.
        0003  HPT343
 # Revisions: 01=HPT366, 03=HPT370, 04=HPT370A, 05=HPT372
        0006  HPT302
        0007  HPT371
        0008  HPT374
+       0009  HPT372N
 1104  RasterOps Corp.
 1105  Sigma Designs, Inc.
        1105  REALmagic Xcard MPEG 1/2/3/4 DVD Decoder
        8300  REALmagic Hollywood Plus DVD Decoder
        8400  EM840x REALmagic DVD/MPEG-2 Audio/Video Decoder
 1106  VIA Technologies, Inc.
+       0102  Embedded VIA Ethernet Controller
        0130  VT6305 1394.A Controller
        0305  VT8363/8365 [KT133/KM133]
                1043 8033  A7V Mainboard
+               1043 803e  A7V-E Mainboard
                1043 8042  A7V133/A7V133-C Mainboard
                147b a401  KT7/KT7-RAID/KT7A/KT7A-RAID Mainboard
        0391  VT8371 [KX133]
        0501  VT8501 [Apollo MVP4]
        0505  VT82C505
-       0561  VT82C561
-       0571  VT82C586B PIPC Bus Master IDE
-               1458 5002 GA-7VAX Mainboard
+# Shares chip with :0576. The VT82C576M has :1571 instead of :0561.
+       0561  VT82C576MV
+       0571  VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE
+               1019 0985  P6VXA Motherboard
+               1043 8052  VT8233A Bus Master ATA100/66/33 IDE
+               1043 808c  A7V8X motherboard
+               1106 0571  VT82C586/B/VT82C686/A/B/VT8233/A/C/VT8235 PIPC Bus Master IDE
+               1179 0001  Magnia Z310
+               1458 5002  GA-7VAX Mainboard
        0576  VT82C576 3V [Apollo Master]
        0585  VT82C585VP [Apollo VP1/VPX]
        0586  VT82C586/A/B PCI-to-ISA [Apollo VP]
        0598  VT82C598 [Apollo MVP3]
        0601  VT8601 [Apollo ProMedia]
        0605  VT8605 [ProSavage PM133]
+               1043 802c  CUV4X mainboard
        0680  VT82C680 [Apollo P6]
        0686  VT82C686 [Apollo Super South]
+               1019 0985  P6VXA Motherboard
+               1043 802c  CUV4X mainboard
                1043 8033  A7V Mainboard
+               1043 803e  A7V-E Mainboard
+               1043 8040  A7M266 Mainboard
                1043 8042  A7V133/A7V133-C Mainboard
                1106 0000  VT82C686/A PCI to ISA Bridge
                1106 0686  VT82C686/A PCI to ISA Bridge
+               1179 0001  Magnia Z310
+               147b a702  KG7-Lite Mainboard
        0691  VT82C693A/694x [Apollo PRO133x]
+               1019 0985  P6VXA Motherboard
+               1179 0001  Magnia Z310
                1458 0691  VT82C691 Apollo Pro System Controller
        0693  VT82C693 [Apollo Pro Plus]
        0698  VT82C693A [Apollo Pro133 AGP]
        0926  VT82C926 [Amazon]
        1000  VT82C570MV
        1106  VT82C570MV
-       1571  VT82C416MV
+       1571  VT82C576M/VT82C586
        1595  VT82C595/97 [Apollo VP2/97]
        3038  USB
                0925 1234  USB Controller
-               1234 0925  MVP3 USB Controller
+               1019 0985  P6VXA Motherboard
+               1043 808c  A7V8X motherboard
+               1179 0001  Magnia Z310
        3040  VT82C586B ACPI
        3043  VT86C100A [Rhine]
                10bd 0000  VT86C100A Fast Ethernet Adapter
        3050  VT82C596 Power Management
        3051  VT82C596 Power Management
        3057  VT82C686 [Apollo Super ACPI]
+               1019 0985  P6VXA Motherboard
                1043 8033  A7V Mainboard
+               1043 803e  A7V-E Mainboard
+               1043 8040  A7M266 Mainboard
                1043 8042  A7V133/A7V133-C Mainboard
+               1179 0001  Magnia Z310
        3058  VT82C686 AC97 Audio Controller
                0e11 b194  Soundmax integrated digital audio
+               1019 0985  P6VXA Motherboard
                1106 4511  Onboard Audio on EP7KXA
                1458 7600  Onboard Audio
                1462 3091  MS-6309 Onboard Audio
                15dd 7609  Onboard Audio
-       3059  VT8233 AC97 Audio Controller
-               1458 a002  GA-7VAX Onboard Audio (Realtek ALC650) 
+       3059  VT8233/A/8235 AC97 Audio Controller
+               1043 8095  A7V8X Motherboard (Realtek ALC650 codec)
+               1458 a002  GA-7VAX Onboard Audio (Realtek ALC650)
        3065  VT6102 [Rhine-II]
+               1106 0102  VT6102 [Rhine II] Embeded Ethernet Controller on VT8235
                1186 1400  DFE-530TX rev A
                1186 1401  DFE-530TX rev B
-       3068  AC97 Modem Controller
+               13b9 1421  LD-10/100AL PCI Fast Ethernet Adapter (rev.B)
+       3068  Intel 537 [AC97 Modem]
        3074  VT8233 PCI to ISA Bridge
+               1043 8052  VT8233A
        3091  VT8633 [Apollo Pro266]
-       3099  VT8367 [KT266]
-               1043 8064  A7V266-E
-               1043 807f  A7V333
+       3099  VT8366/A/7 [Apollo KT266/A/333]
+               1043 8064  A7V266-E Mainboard
+               1043 807f  A7V333 Mainboard
        3101  VT8653 Host Bridge
        3102  VT8662 Host Bridge
        3103  VT8615 Host Bridge
        3104  USB 2.0
+               1043 808c  A7V8X motherboard
                1458 5004  GA-7VAX Mainboard
+       3106  VT6105 [Rhine-III]
        3109  VT8233C PCI to ISA Bridge
        3112  VT8361 [KLE133] Host Bridge
+       3116  VT8375 [KM266/KL266] Host Bridge
+# found on EPIA M6000/9000 mainboard
+       3122  VT8623 [Apollo CLE266] integrated CastleRock graphics
+# found on EPIA M6000/9000 mainboard
+       3123  VT8623 [Apollo CLE266]
        3128  VT8753 [P4X266 AGP]
        3133  VT3133 Host Bridge
        3147  VT8233A ISA Bridge
        3148  P4M266 Host Bridge
        3156  P/KN266 Host Bridge
-       3177  VT8233A ISA Bridge
-               1458 5001 GA-7VAX Mainboard
+       3168  VT8374 P4X400 Host Controller/AGP Bridge
+       3177  VT8235 ISA Bridge
+               1043 808c  A7V8X motherboard
+               1458 5001  GA-7VAX Mainboard
        3189  VT8377 [KT400 AGP] Host Bridge
-               1458 5000 GA-7VAX Mainboard
+               1043 807f  A7V8X motherboard
+               1458 5000  GA-7VAX Mainboard
        5030  VT82C596 ACPI [Apollo PRO]
        6100  VT85C100A [Rhine II]
        8231  VT8231 [PCI-to-ISA Bridge]
        8596  VT82C596 [Apollo PRO AGP]
        8597  VT82C597 [Apollo VP3 AGP]
        8598  VT82C598/694x [Apollo MVP3/Pro133x AGP]
+               1019 0985  P6VXA Motherboard
        8601  VT8601 [Apollo ProMedia AGP]
        8605  VT8605 [PM133 AGP]
        8691  VT82C691 [Apollo Pro]
        8693  VT82C693 [Apollo Pro Plus] PCI Bridge
        b091  VT8633 [Apollo Pro266 AGP]
-       b099  VT8367 [KT333 AGP]
+       b099  VT8366/A/7 [Apollo KT266/A/333 AGP]
        b101  VT8653 AGP Bridge
        b102  VT8362 AGP Bridge
        b103  VT8615 AGP Bridge
 110a  Siemens Nixdorf AG
        0002  Pirahna 2-port
        0005  Tulip controller, power management, switch extender
+       0006  FSC PINC (I/O-APIC)
+       0015  FSC Multiprocessor Interrupt Controller
+       001d  FSC Copernicus Management Controller
+       007b  FSC Remote Service Controller, mailbox device
+       007c  FSC Remote Service Controller, shared memory device
+       007d  FSC Remote Service Controller, SMIC device
        2102  DSCC4 WAN adapter
        4942  FPGA I-Bus Tracer for MBD
        6120  SZB6120
        6037  Firepower Powerized SMP I/O ASIC
        6073  Firepower Powerized SMP I/O ASIC
 1111  Santa Cruz Operation
-# DJ: Some people say that 0x1112 is Rockwell International
-1112  RNS - Div. of Meret Communications Inc
+# Also claimed to be RNS or Rockwell International, current PCISIG records list Osicom
+1112  Osicom Technologies Inc
        2200  FDDI Adapter
        2300  Fast Ethernet Adapter
        2340  4 Port Fast Ethernet Adapter
                103c 1207  EN-1207D Fast Ethernet Adapter
                1113 1211  EN-1207D Fast Ethernet Adapter
        1216  EN-1216 Ethernet Adapter
+               111a 1020  SpeedStream 1020 PCI 10/100 Ethernet Adaptor [EN-1207F-TX ?]
        1217  EN-1217 Ethernet Adapter
        5105  10Mbps Network card
        9211  EN-1207D Fast Ethernet Adapter
        0001  MVC IM-PCI Video frame grabber/processor
 1130  Computervision
 1131  Philips Semiconductors
+       1561  USB 1.1 Host Controller
+       1562  USB 2.0 Host Controller
+       3400  SmartPCI56(UCB1500) 56K Modem
        7130  SAA7130 Video Broadcast Decoder
+       7133  SAA7133 Audio+video broadcast decoder
 # PCI audio and video broadcast decoder (http://www.semiconductors.philips.com/pip/saa7134hl)
        7134  SAA7134
+       7135  SAA7135 Audio+video broadcast decoder
        7145  SAA7145
        7146  SAA7146
                114b 2003  DVRaptor Video Edit/Capture Card
                1133 e004  DIVA 2.0 U
        e005  DIVA LOW
                1133 e005  DIVA 2.01 S/T
+       e00b  DIVA 2.02
        e010  DIVA Server BRI-2M
                1133 e010  DIVA Server BRI-2M
        e012  DIVA Server BRI-8M
 1144  Cincinnati Milacron
        0001  Noservo controller
 1145  Workbit Corporation
-       f007  NinjaSCSI-32 KME
        8007  NinjaSCSI-32 Workbit
+       f007  NinjaSCSI-32 KME
        f010  NinjaSCSI-32 Workbit
        f012  NinjaSCSI-32 Logitec
        f013  NinjaSCSI-32 Logitec
                1148 5844  FDDI SK-5844 (SK-NET FDDI-LP64 DAS)
        4200  Token Ring adapter
        4300  SK-98xx Gigabit Ethernet Server Adapter
-               1148 9821  SK-9821 Gigabit Ethernet 1000Base-T Server Adapter
-               1148 9822  SK-9822 Gigabit Ethernet 1000Base-T Dual Port Server Adapter
-               1148 9841  SK-9841 Gigabit Ethernet 1000Base-LX Server Adapter
-               1148 9842  SK-9842 Gigabit Ethernet 1000Base-LX Dual Port Server Adapter
-               1148 9843  SK-9843 Gigabit Ethernet 1000Base-SX Server Adapter
-               1148 9844  SK-9844 Gigabit Ethernet 1000Base-SX Dual Port Server Adapter
-               1148 9861  SK-9861 Gigabit Ethernet 1000Base-SX Server Adapter
-               1148 9862  SK-9862 Gigabit Ethernet 1000Base-SX Dual Port Server Adapter
-               1148 9871  SK-9871 Gigabit Ethernet 1000Base-ZX Server Adapter
-               1148 9872  SK-9872 Gigabit Ethernet 1000Base-ZX Dual Port Server Adapter
-       4320  SK-98xx Gigabit Ethernet Server Adapter
-               1148 9521  SK-9521 10/100/1000Base-T Adapter
+               1148 9821  SK-9821 Gigabit Ethernet Server Adapter (SK-NET GE-T)
+               1148 9822  SK-9822 Gigabit Ethernet Server Adapter (SK-NET GE-T dual link)
+               1148 9841  SK-9841 Gigabit Ethernet Server Adapter (SK-NET GE-LX)
+               1148 9842  SK-9842 Gigabit Ethernet Server Adapter (SK-NET GE-LX dual link)
+               1148 9843  SK-9843 Gigabit Ethernet Server Adapter (SK-NET GE-SX)
+               1148 9844  SK-9844 Gigabit Ethernet Server Adapter (SK-NET GE-SX dual link)
+               1148 9861  SK-9861 Gigabit Ethernet Server Adapter (SK-NET GE-SX Volition)
+               1148 9862  SK-9862 Gigabit Ethernet Server Adapter (SK-NET GE-SX Volition dual link)
+# Information got from SysKonnekt
+               1148 9871  SK-9871 Gigabit Ethernet Server Adapter (SK-NET GE-ZX)
+# Information got from SysKonnekt
+               1148 9872  SK-9872 Gigabit Ethernet Server Adapter (SK-NET GE-ZX dual link)
+               1259 2970  Allied Telesyn AT-2970SX Gigabit Ethernet Adapter
+               1259 2971  Allied Telesyn AT-2970LX Gigabit Ethernet Adapter
+               1259 2972  Allied Telesyn AT-2970TX Gigabit Ethernet Adapter
+               1259 2973  Allied Telesyn AT-2971SX Gigabit Ethernet Adapter
+               1259 2974  Allied Telesyn AT-2971T Gigabit Ethernet Adapter
+               1259 2975  Allied Telesyn AT-2970SX/2SC Gigabit Ethernet Adapter
+               1259 2976  Allied Telesyn AT-2970LX/2SC Gigabit Ethernet Adapter
+               1259 2977  Allied Telesyn AT-2970TX/2TX Gigabit Ethernet Adapter
+       4320  SK-98xx V2.0 Gigabit Ethernet Adapter
+               1148 0121  Marvell RDK-8001 Adapter
+               1148 0221  Marvell RDK-8002 Adapter
+               1148 0321  Marvell RDK-8003 Adapter
+               1148 0421  Marvell RDK-8004 Adapter
+               1148 0621  Marvell RDK-8006 Adapter
+               1148 0721  Marvell RDK-8007 Adapter
+               1148 0821  Marvell RDK-8008 Adapter
+               1148 0921  Marvell RDK-8009 Adapter
+               1148 1121  Marvell RDK-8011 Adapter
+               1148 1221  Marvell RDK-8012 Adapter
+               1148 3221  SK-9521 V2.0 10/100/1000Base-T Adapter
                1148 5021  SK-9821 V2.0 Gigabit Ethernet 10/100/1000Base-T Adapter
                1148 5041  SK-9841 V2.0 Gigabit Ethernet 1000Base-LX Adapter
                1148 5043  SK-9843 V2.0 Gigabit Ethernet 1000Base-SX Adapter
                1148 5051  SK-9851 V2.0 Gigabit Ethernet 1000Base-SX Adapter
                1148 5061  SK-9861 V2.0 Gigabit Ethernet 1000Base-SX Adapter
                1148 5071  SK-9871 V2.0 Gigabit Ethernet 1000Base-ZX Adapter
-       4400  Gigabit Ethernet
+               1148 9521  SK-9521 10/100/1000Base-T Adapter
 1149  Win System Corporation
 114a  VMIC
        5579  VMIPCI-5579 (Reflective Memory Card)
+       5587  VMIPCI-5587 (Reflective Memory Card)
+       6504  VMIC PCI 7755 FPGA
        7587  VMIVME-7587
 114b  Canopus Co., Ltd
 114c  Annabooks
        0001  Motion TPEG Recorder/Player with audio
 1166  ServerWorks
        0005  CNB20-LE Host Bridge
+       0006  CNB20HE Host Bridge
        0007  CNB20-LE Host Bridge
        0008  CNB20HE Host Bridge
        0009  CNB20LE Host Bridge
        0010  CIOB30
        0011  CMIC-HE
+       0012  CMIC-LE
        0013  CNB20-HE Host Bridge
        0014  CNB20-HE Host Bridge
        0015  CMIC-GC Host Bridge
        0465  RL5c465
        0466  RL5c466
        0475  RL5c475
+               144d c006  vpr Matrix 170B4 CardBus bridge
        0476  RL5c476 II
+               1014 0185  ThinkPad A/T/X Series
                104d 80df  Vaio PCG-FX403
                104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
        0477  RL5c477
        0522  R5C522 IEEE 1394 Controller
                1014 01cf  ThinkPad A30p (2653-64G)
        0551  R5C551 IEEE 1394 Controller
+               144d c006  vpr Matrix 170B4
        0552  R5C552 IEEE 1394 Controller
+               1014 0511  ThinkPad A/T/X Series
 1181  Telmatics International
 1183  Fujikura Ltd
 1184  Forks Inc
        1340  DFE-690TXD CardBus PC Card
        1561  DRP-32TXD Cardbus PC Card
        4000  DL2K Ethernet
+       4c00  Gigabit Ethernet Adapter
+               1186 4c00  DGE-530T Gigabit Ethernet Adapter
 1187  Advanced Technology Laboratories, Inc.
 1188  Shima Seiki Manufacturing Ltd.
 1189  Matsushita Electronics Co Ltd
        4240  AMCC S933Q Intelligent Serial Card
 11aa  Actel
 11ab  Galileo Technology Ltd.
-       0146  GT-64010
+       0146  GT-64010/64010A System Controller
+       4146  GT-64011/GT-64111 System Controller
+       4320  Gigabit Ethernet Adapter
+               1019 0f38  Marvell 88E8001 Gigabit LOM Ethernet Adapter (ECS)
+               1019 8001  Marvell 88E8001 Gigabit LOM Ethernet Adapter (ECS)
+               1043 173c  Marvell 88E8001 Gigabit LOM Ethernet Adapter (Asus)
+               1043 811a  Marvell 88E8001 Gigabit LOM Ethernet Adapter (Asus)
+               105b 0c19  Marvell 88E8001 Gigabit LOM Ethernet Adapter (Foxconn)
+               10b8 b452  SMC EZ Card 1000 (SMC9452TXV.2)
+               11ab 0121  Marvell RDK-8001 Adapter
+               11ab 0321  Marvell RDK-8003 Adapter
+               11ab 1021  Marvell RDK-8010 Adapter
+               11ab 5021  Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Adapter (64 bit)
+               11ab 9521  Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Adapter (32 bit)
+               1458 e000  Marvell 88E8001 Gigabit LOM Ethernet Adapter (Gigabyte)
+               147b 1406  Marvell 88E8001 Gigabit LOM Ethernet Adapter (Abit)
+               15d4 0047  Marvell 88E8001 Gigabit LOM Ethernet Adapter (Iwill)
+               1695 9025  Marvell 88E8001 Gigabit LOM Ethernet Adapter (Epox)
+               17f2 1c03  Marvell 88E8001 Gigabit LOM Ethernet Adapter (Albatron)
+       4611  GT-64115 System Controller
+       4620  GT-64120/64120A/64121A System Controller
        4801  GT-48001
        f003  GT-64010 Primary Image Piranha Image Generator
 11ac  Canon Information Systems Research Aust.
        0443  LT WinModem
        0444  LT WinModem
        0445  LT WinModem
+               8086 2203  PRO/100+ MiniPCI (probably an Ambit U98.003.C.00 combo card)
        0446  LT WinModem
        0447  LT WinModem
        0448  WinModem 56k
        044e  LT WinModem
        044f  V90 WildWire Modem
        0450  LT WinModem
+               144f 4005  Magnia SG20
        0451  LT WinModem
        0452  LT WinModem
        0453  LT WinModem
        0458  LT WinModem
        0459  LT WinModem
        045a  LT WinModem
+       045c  LT WinModem
        0461  V90 WildWire Modem
        0462  V90 WildWire Modem
        0480  Venus Modem (V90, 56KFlex)
        5801  USB
        5802  USS-312 USB Controller
+# 4 port PCI USB Controller made by Agere (formely Lucent)
+       5803  USS-344S USB Controller
        5811  FW323
                dead 0800  FireWire Host Bus Adapter
 11c2  Sand Microelectronics
-11c3  NEC Corp
+11c3  NEC Corporation
 11c4  Document Technologies, Inc
 11c5  Shiva Corporation
 11c6  Dainippon Screen Mfg. Co. Ltd
 11e1  GEC Plessey Semi Inc.
 11e2  Samsung Information Systems America
 11e3  Quicklogic Corporation
+       5030  PC Watchdog
 11e4  Second Wave Inc
 11e5  IIX Consulting
 11e6  Mitsui-Zosen System Research
 1200  CSS Corporation
 1201  Vista Controls Corp
 1202  Network General Corp.
+       4300  Gigabit Ethernet Adapter
+               1202 9841  SK-9841 LX
+               1202 9842  SK-9841 LX dual link
+               1202 9843  SK-9843 SX
+               1202 9844  SK-9843 SX dual link
 1203  Bayer Corporation, Agfa Division
 1204  Lattice Semiconductor Corporation
 1205  Array Corporation
        6933  OZ6933 Cardbus Controller
                1025 1016  Travelmate 612 TX
        6972  OZ6912 Cardbus Controller
+               1179 0001  Magnia Z310
 1218  Hybricon Corp.
 1219  First Virtual Corporation
 121a  3Dfx Interactive, Inc.
                139c 0016  Raven
                139c 0017  Raven
                14af 0002  Maxi Gamer Phoenix
-               3030 3030  Skywell Magic TwinPower
        0004  Voodoo Banshee [Velocity 100]
        0005  Voodoo 3
                121a 0004  Voodoo3 AGP
 1249  Samsung Electronics Co., Ltd.
 124a  AEG Electrocom GmbH
 124b  SBS/Greenspring Modular I/O
-       0040  cPCI-200 Four Slot IndustryPack carrier
+       0040  PCI-40A or cPCI-200 Quad IndustryPack carrier
                124b 9080  PCI9080 Bridge
 124c  Solitron Technologies, Inc.
 124d  Stallion Technologies, Inc.
                125d 8888  Solo-1 Audio Adapter
                525f c888  ES1969 SOLO-1 AudioDrive (+ES1938)
        1978  ES1978 Maestro 2E
+               0e11 b112  Armada M700
                1033 803c  ES1978 Maestro-2E Audiodrive
                1033 8058  ES1978 Maestro-2E Audiodrive
                1092 4000  Monster Sound MX400
 1260  Harris Semiconductor
        3873  Prism 2.5 Wavelan chipset
                1186 3501  DWL-520 Wireless PCI Adapter
+               1668 0414  HWP01170-01 802.11b PCI Wireless Adapter
+               1737 3874  WMP11 Wireless 802.11b PCI Adapter
+               8086 2513  Wireless 802.11b MiniPCI Adapter
+       3890  D-Links DWL-g650 A1
        8130  HMP8130 NTSC/PAL Video Decoder
        8131  HMP8131 NTSC/PAL Video Decoder
 1261  Matsushita-Kotobuki Electronics Industries, Ltd.
 1273  Hughes Network Systems
        0002  DirecPC
 1274  Ensoniq
+       1171  ES1373 [AudioPCI] (also Creative Labs CT5803)
        1371  ES1371 [AudioPCI-97]
                0e11 0024  AudioPCI on Motherboard Compaq Deskpro
                0e11 b1a7  ES1371, ES1373 AudioPCI
 1277  Comstream
 1278  Transtech Parallel Systems Ltd.
        0701  TPE3/TM3 PowerPC Node
+       0710  TPE5 PowerPC PCI board
 1279  Transmeta Corporation
        0295  Northbridge
        0395  LongRun Northbridge
        9132  Ethernet 100/10 MBit
 1283  Integrated Technology Express, Inc.
        673a  IT8330G
+       8181  IT8181E/F LCD/VGA Controller
        8330  IT8330G
        8888  IT8888F PCI to ISA Bridge with SMB
        8889  IT8889F PCI to ISA Bridge
                12ae 0001  Gigabit Ethernet-SX (Universal)
                1410 0104  Gigabit Ethernet-SX PCI Adapter
        0002  AceNIC Gigabit Ethernet (Copper)
+               10a9 8002  Acenic Gigabit Ethernet
                12ae 0002  Gigabit Ethernet-T (3C986-T)
 12af  TDK USA Corp
 12b0  Jorge Scientific Corp
                12b9 00ab  USR 56k Internal Voice Modem (Model 5609)
                12b9 00ac  USR 56k Internal Voice Modem (Model 3298)
                12b9 00ad  USR 56k Internal FAX Modem (Model 5610)
-12ba  PMC Sierra
+12ba  BittWare, Inc.
 12bb  Nippon Unisoft Corporation
 12bc  Array Microsystems
 12bd  Computerm Corp.
        00a0  ITNT2
 12d3  Vingmed Sound A/S
 12d4  Ulticom (Formerly DGM&S)
+       0200  T1 Card
 12d5  Equator Technologies
 12d6  Analogic Corp
 12d7  Biotronic SRL
 12d8  Pericom Semiconductor
 12d9  Aculab PLC
+       0002  PCI Prosody
+       0004  cPCI Prosody
 12da  True Time Inc.
 12db  Annapolis Micro Systems, Inc
 12dc  Symicron Computer Communication Ltd.
        0036  PCI-DAS64/M2/16
        0037  PCI-DAS64/M3/16
        004c  PCI-DAS1000
+       004d  PCI-QUAD04
 1308  Jato Technologies Inc.
        0001  NetCelerator Adapter
                1308 0001  NetCelerator Adapter
 1330  MMC Networks
 1331  Radisys Corp.
 1332  Micro Memory
+       5415  MM-5415CN PCI Memory Module with Battery Backup
+       5425  MM-5425CN PCI 64/66 Memory Module with Battery Backup
 1334  Redcreek Communications, Inc
 1335  Videomail, Inc
 1337  Third Planet Publishing
 134f  Algo System Co Ltd
 1350  Systec Co. Ltd
 1351  Sonix Inc
-1353  Dassault A.T.
+1353  Thales Idatys
+       0002  Proserver
+       0003  PCI-FUT
+       0004  PCI-S0
+       0005  PCI-FUT-S0
 1354  Dwave System Inc
 1355  Kratos Analytical Ltd
 1356  The Logical Co
 135a  Brain Boxes
 135b  Giganet Inc
 135c  Quatech Inc
+       0010  QSC-100
+       0020  DSC-100
+       0030  DSC-200/300
+       0040  QSC-200/300
+       0050  ESC-100D
+       0060  ESC-100M
        00f0  MPAC-100 Syncronous Serial Card (Zilog 85230)
+       0170  QSCLP-100
+       0180  DSCLP-100
+       0190  SSCLP-100
+       01a0  QSCLP-200/300
+       01b0  DSCLP-200/300
+       01c0  SSCLP-200/300
 135d  ABB Network Partner AB
 135e  Sealevel Systems Inc
        7101  Single Port RS-232/422/485/530
 136f  Applied Magic Inc
 1370  ATL Products
 1371  CNet Technology Inc
+       434e  GigaCard Network Adapter
+               1371 434e  N-Way PCI-Bus Giga-Card 1000/100/10Mbps(L)
 1373  Silicon Vision Inc
 1374  Silicom Ltd
 1375  Argosystems Inc
 1384  Reality Simulation Systems Inc
 1385  Netgear
        4100  802.11b Wireless Adapter (MA301)
+       4105  MA311 802.11b wireless adapter
        620a  GA620
        622a  GA622
        630a  GA630
        0006  6500 Public Key Processor
        0007  7811 Security Processor
        0012  7951 Security Processor
+       0014  78XX Security Processor
+       0016  8065 Security Processor
+       0017  8165 Security Processor
+       0018  8154 Security Processor
 13a4  Rascom Inc
 13a5  Audio Digital Imaging Inc
 13a6  Videonics Inc
 13ce  Cocom A/S
 13cf  Studio Audio & Video Ltd
 13d0  Techsan Electronics Co Ltd
+# http://www.b2c2inc.com/products/pc-specs.html
+       2103  B2C2 Sky2PC PCI [SkyStar2]
 13d1  Abocom Systems Inc
+       ab02  ADMtek Centaur-C rev 17 [D-Link DFE-680TX] CardBus Fast Ethernet Adapter
        ab06  RTL8139 [FE2000VX] CardBus Fast Ethernet Attached Port Adapter
 13d2  Shark Multimedia Inc
 13d3  IMC Networks
 13e6  Argosy research Inc
 13e7  NAC Incorporated
 13e8  Chip Express Corporation
-13e9  Chip Express Corporation
+13e9  Intraserver Technology Inc
 13ea  Dallas Semiconductor
 13eb  Hauppauge Computer Works Inc
 13ec  Zydacron Inc
        0101  CM8338B
                13f6 0101  CMI8338-031 PCI Audio Device
        0111  CM8738
+               1019 0970  P6STP-FL motherboard
                1043 8077  CMI8738 6-channel audio controller
                1043 80e2  CMI8738 6ch-MX
                13f6 0111  CMI8738/C3DX PCI Audio Device
+               1681 a000  Gamesurround MUSE XL
        0211  CM8738
 13f7  Wildfire Communications
 13f8  Ad Lib Multimedia Inc
 1411  Ikos Systems Inc
 1412  IC Ensemble Inc
        1712  ICE1712 [Envy24]
+       1724  ICE1724 [Envy24HT]
 1413  Addonics
 1414  Microsoft Corporation
 1415  Oxford Semiconductor Ltd
        0001  NextMove PCI
 1460  DYNARC INC
 1461  Avermedia Technologies Inc
-1462  Micro-star International Co Ltd
+1462  Micro-Star International Co., Ltd.
 1463  Fast Corporation
 1464  Interactive Circuits & Systems Ltd
 1465  GN NETTEST Telecom DIV.
 146a  IFR
 146b  Parascan Technologies Ltd
 146c  Ruby Tech Corp.
+       1430  FE-1430TX Fast Ethernet PCI Adapter
 146d  Tachyon, INC.
 146e  Williams Electronics Games, Inc.
 146f  Multi Dimensional Consulting Inc
 149b  SEIKO Instruments Inc
 149c  OVISLINK Corp.
 149d  NEWTEK Inc
+       0001  Video Toaster for PC
 149e  Mapletree Networks Inc.
 149f  LECTRON Co Ltd
 14a0  SOFTING GmBH
 14ad  Time Space Radio AB
 14ae  CTI, Inc
 14af  Guillemot Corporation
+       7102  3D Prophet II MX
 14b0  BST Communication Technology Ltd
 14b1  Nextcom K.K.
 14b2  ENNOVATE Networks Inc
        0000  DSL NIC
 14b4  PHILIPS Business Electronics B.V.
 14b5  Creamware GmBH
+       0200  Scope
+       0300  Pulsar
+       0400  Pulsar2
+       0600  Pulsar2
+       0800  DSP-Board
+       0900  DSP-Board
+       0a00  DSP-Board
+       0b00  DSP-Board
 14b6  Quantum Data Corp.
 14b7  PROXIM Inc
        0001  Symphony 4110
        0350  PC4800
        4500  PC4500
        4800  PC4800
+       a504  Cisco Aironet Wireless 802.11b
 14ba  INTERNIX Inc.
 14bb  SEMTECH Corporation
 14bc  Globespan Semiconductor Inc.
 14e3  AMTELCO
 14e4  Broadcom Corporation
        1644  NetXtreme BCM5700 Gigabit Ethernet
-               1014 0277  Broadcom Vigil B5700 1000BaseTX
+               1014 0277  Broadcom Vigil B5700 1000Base-T
                1028 00d1  Broadcom BCM5700
                1028 0106  Broadcom BCM5700
-               1028 0109  Broadcom BCM5700 1000BaseTX
+               1028 0109  Broadcom BCM5700 1000Base-T
                1028 010a  Broadcom BCM5700 1000BaseTX
-               10b7 1000  3C996-T 1000BaseTX
-               10b7 1001  3C996B-T 1000BaseTX
-               10b7 1002  3C996C-T 1000BaseTX
-               10b7 1003  3C997-T 1000BaseTX Dual Port
-               10b7 1004  3C996-SX 1000BaseSX
-               10b7 1005  3C997-SX 1000BaseSX Dual Port
+               10b7 1000  3C996-T 1000Base-T
+               10b7 1001  3C996B-T 1000Base-T
+               10b7 1002  3C996C-T 1000Base-T
+               10b7 1003  3C997-T 1000Base-T Dual Port
+               10b7 1004  3C996-SX 1000Base-SX
+               10b7 1005  3C997-SX 1000Base-SX Dual Port
                10b7 1008  3C942 Gigabit LOM (31X31)
-               14e4 0002  NetXtreme 1000BaseSX
-               14e4 0003  NetXtreme 1000BaseSX
-               14e4 0004  NetXtreme 1000BaseTX
+               14e4 0002  NetXtreme 1000Base-SX
+               14e4 0003  NetXtreme 1000Base-SX
+               14e4 0004  NetXtreme 1000Base-T
                14e4 1028  NetXtreme 1000BaseTX
-               14e4 1644  BCM5700 1000BaseTX
+               14e4 1644  BCM5700 1000Base-T
        1645  NetXtreme BCM5701 Gigabit Ethernet
                0e11 007c  NC7770 Gigabit Server Adapter (PCI-X, 10/100/1000-T)
                0e11 007d  NC6770 Gigabit Server Adapter (PCI-X, 1000-SX)
                0e11 0085  NC7780 Gigabit Server Adapter (embedded, WOL)
                0e11 0099  NC7780 Gigabit Server Adapter (embedded, WOL)
                0e11 009a  NC7770 Gigabit Server Adapter (PCI-X, 10/100/1000-T)
-               1028 0121  Broadcom BCM5701 1000BaseTX
-               10b7 1004  3C996-SX 1000BaseSX
-               10b7 1006  3C996B-T 1000BaseTX
-               10b7 1007  3C1000-T 1000BaseTX
-               10b7 1008  3C940-BR01 1000BaseTX
-               14e4 0001  BCM5701 1000BaseTX
-               14e4 0005  BCM5701 1000BaseTX
-               14e4 0006  BCM5701 1000BaseTX
-               14e4 0007  BCM5701 1000BaseSX
-               14e4 0008  BCM5701 1000BaseTX
-               14e4 8008  BCM5701 1000BaseTX
+               0e11 00c1  NC6770 Gigabit Server Adapter (PCI-X, 1000-SX)
+               1028 0121  Broadcom BCM5701 1000Base-T
+               10a9 8010  SGI IO9 Gigabit Ethernet (Copper)
+               10a9 8011  SGI Gigabit Ethernet (Copper)
+               10a9 8012  SGI Gigabit Ethernet (Fiber)
+               10b7 1004  3C996-SX 1000Base-SX
+               10b7 1006  3C996B-T 1000Base-T
+               10b7 1007  3C1000-T 1000Base-T
+               10b7 1008  3C940-BR01 1000Base-T
+               14e4 0001  BCM5701 1000Base-T
+               14e4 0005  BCM5701 1000Base-T
+               14e4 0006  BCM5701 1000Base-T
+               14e4 0007  BCM5701 1000Base-SX
+               14e4 0008  BCM5701 1000Base-T
+               14e4 8008  BCM5701 1000Base-T
        1646  NetXtreme BCM5702 Gigabit Ethernet
                0e11 00bb  NC7760 1000BaseTX
                1028 0126  Broadcom BCM5702 1000BaseTX
        1647  NetXtreme BCM5703 Gigabit Ethernet
                0e11 0099  NC7780 1000BaseTX
                0e11 009a  NC7770 1000BaseTX
+               10a9 8010  SGI IO9 Gigabit Ethernet (Copper)
                14e4 0009  BCM5703 1000BaseTX
                14e4 000a  BCM5703 1000BaseSX
                14e4 000b  BCM5703 1000BaseTX
                14e4 8009  BCM5703 1000BaseTX
                14e4 800a  BCM5703 1000BaseTX
        1648  NetXtreme BCM5704 Gigabit Ethernet
+               0e11 00cf  NC7772 Gigabit Server Adapter (PCI-X, 10,100,1000-T)
+               0e11 00d0  NC7782 Gigabit Server Adapter (PCI-X, 10,100,1000-T)
+               0e11 00d1  NC7783 Gigabit Server Adapter (PCI-X, 10,100,1000-T)
+               10b7 2000  3C998-T Dual Port 10/100/1000 PCI-X
+               10b7 3000  3C999-T Quad Port 10/100/1000 PCI-X
+               1166 1648  NetXtreme CIOB-E 1000Base-T
+       1649  NetXtreme BCM5704S Gigabit Ethernet
        164d  NetXtreme BCM5702FE Gigabit Ethernet
-       16a6  NetXtreme BCM5702X Gigabit Ethernet
-       16a7  NetXtreme BCM5703X Gigabit Ethernet
+       1653  NetXtreme BCM5705 Gigabit Ethernet
+       1654  NetXtreme BCM5705 Gigabit Ethernet
+       165d  NetXtreme BCM5705M Gigabit Ethernet
+       165e  NetXtreme BCM5705M Gigabit Ethernet
+       166e  NetXtreme BCM5705F Gigabit Ethernet
+       1696  NetXtreme BCM5782 Gigabit Ethernet
+               14e4 000d  NetXtreme BCM5782 1000Base-T
+       169c  NetXtreme BCM5788 Gigabit Ethernet
+       16a6  NetXtreme BCM5702 Gigabit Ethernet
+               0e11 00bb  NC7760 Gigabit Server Adapter (PCI-X, 10/100/1000-T)
+               1028 0126  BCM5702 1000Base-T
+               14e4 000c  BCM5702 1000Base-T
+               14e4 8009  BCM5702 1000Base-T
+       16a7  NetXtreme BCM5703 Gigabit Ethernet
+               0e11 00ca  NC7771 Gigabit Server Adapter (PCI-X, 10,100,1000-T)
+               0e11 00cb  NC7781 Gigabit Server Adapter (PCI-X, 10,100,1000-T)
+               14e4 0009  NetXtreme BCM5703 1000Base-T
+               14e4 000a  NetXtreme BCM5703 1000Base-SX
+               14e4 000b  NetXtreme BCM5703 1000Base-T
+               14e4 800a  NetXtreme BCM5703 1000Base-T
        16a8  NetXtreme BCM5704S Gigabit Ethernet
-       16c6  NetXtreme BCM5702A3 Gigabit Ethernet
-       16c7  NetXtreme BCM5703A3 Gigabit Ethernet
-       4212  BCM v.90 56k modem
+               10b7 2001  3C998-SX Dual Port 1000-SX PCI-X
+       16c6  NetXtreme BCM5702 Gigabit Ethernet
+               10b7 1100  3C1000B-T 10/100/1000 PCI
+               14e4 000c  BCM5702 1000Base-T
+               14e4 8009  BCM5702 1000Base-T
+       16c7  NetXtreme BCM5703 Gigabit Ethernet
+               14e4 0009  NetXtreme BCM5703 1000Base-T
+               14e4 000a  NetXtreme BCM5703 1000Base-SX
+       170d  NetXtreme BCM5901 Gigabit Ethernet
+       170e  NetXtreme BCM5901 Gigabit Ethernet
+       4210  BCM4210 iLine10 HomePNA 2.0
+       4211  BCM4211 iLine10 HomePNA 2.0 + V.90 56k modem
+       4212  BCM4212 v.90 56k modem
+       4301  BCM4301 802.11b
+       4320  BCM94306 802.11g
+       4401  BCM4401 100Base-T
+               1043 80a8  A7V8X motherboard
+       4402  BCM4402 Integrated 10/100BaseT
+       4410  BCM4413 iLine32 HomePNA 2.0
+       4411  BCM4413 V.90 56k modem
+       4412  BCM4413 10/100BaseT
        5820  BCM5820 Crypto Accelerator
        5821  BCM5821 Crypto Accelerator
 14e5  Pixelfusion Ltd
                122d 4302  Dell MP3930V-W(C) MiniPCI
        1610  ADSL AccessRunner PCI Arbitration Device
        1611  AccessRunner PCI ADSL Interface Device
+       1620  ADSL AccessRunner V2 PCI Arbitration Device
+       1621  AccessRunner V2 PCI ADSL Interface Device
+       1622  AccessRunner V2 PCI ADSL Yukon WAN Adapter
        1803  HCF 56k Modem
                0e11 0023  623-LAN Grizzly
                0e11 0043  623-LAN Yogi
 14f9  AG COMMUNICATIONS
 14fa  WANDEL & GOCHERMANN
 14fb  TRANSAS MARINE (UK) Ltd
-14fc  QUADRICS Supercomputers World
+14fc  Quadrics Ltd
+       0000  QsNet Cluster Interconnect
+       0001  QsNetII Cluster Interconnect
 14fd  JAPAN Computer Industry Inc
 14fe  ARCHTEK TELECOM Corp
 14ff  TWINHEAD INTERNATIONAL Corp
                1522 0400  RockForceDUO+ 2 Port V.92/V.44 Data/Fax/Voice Modem
                1522 0500  RockForceQUATRO+ 4 Port V.92/V.44 Data/Fax/Voice Modem
                1522 0600  RockForce+ 2 Port V.90 Data/Fax/Voice Modem
+               1522 0700  RockForce+ 4 Port V.90 Data/Fax/Voice Modem
+               1522 0800  RockForceOCTO+ 8 Port V.92/V.44 Data/Fax/Voice Modem
 1523  MUSIC Semiconductors
 1524  ENE Technology Inc
+       1211  CB1211 Cardbus Controller
+       1225  CB1225 Cardbus Controller
+       1410  CB1410 Cardbus Controller
+       1420  CB1420 Cardbus Controller
 1525  IMPACT Technologies
 1526  ISS, Inc
 1527  SOLECTRON
 1541  MACHONE Communications
 1542  VIVID Technology Inc
 1543  SILICON Laboratories
+       3052  Intel 537 [Winmodem]
+       4c22  Si3036 MC'97 DAA
 1544  DCM DATA Systems
 1545  VISIONTEK
 1546  IOI Technology Corp
 15e8  National Datacomm Corp
        0130  Wireless PCI Card
 15e9  Pacific Digital Corp
+       1841  ADMA-100 DiscStaQ ATA Controller
 15ea  Tokyo Denshi Sekei K.K.
 15eb  Drsearch GmbH
 15ec  Beckhoff GmbH
 1607  Lava Semiconductor Manufacturing Inc
 1608  Automated Wagering International
 1609  Scimetric Instruments Inc
+1612  Telesynergy Research Inc.
 1619  FarSite Communications Ltd
        0400  FarSync T2P (2 port X.21/V.35/V.24)
        0440  FarSync T4P (4 port X.21/V.35/V.24)
        2002  Fast Universal Data Output
 1638  Standard Microsystems Corp [SMC]
        1100  SMC2602W EZConnect / Addtron AWA-100
+163c  Smart Link Ltd.
+       3052  SmartLink SmartPCI562 56K Modem
+       5449  SmartPCI561 Modem
 1657  Brocade Communications Systems, Inc.
+165a  Epix Inc
+       c100  PIXCI(R) CL1 Camera Link Video Capture Board [custom QL5232]
+       d200  PIXCI(R) D2X Digital Video Capture Board [custom QL5232]
+       d300  PIXCI(R) D3X Digital Video Capture Board [custom QL5232]
 165d  Hsing Tech. Enterprise Co., Ltd.
 1661  Worldspace Corp.
-1668  Action Tec Electronics Inc
+1668  Actiontec Electronics Inc
+1681  Hercules
+16ab  Global Sun Technology Inc
+       1102  PCMCIA-to-PCI Wireless Network Bridge
+16be  Creatix Polymedia GmbH
+16ca  CENATEK Inc
+       0001  Rocket Drive DL
 16ec  U.S. Robotics
        3685  Wireless Access PCI Adapter Model 022415
 16f6  VideoTele.com, Inc.
+1705  Digital First, Inc.
 170b  NetOctave Inc
 170c  YottaYotta Inc.
+172a  Accelerated Encryption
+1737  Linksys
+       1032  Gigabit Network Adapter
+               1737 0015  EG1032 v2 Instant Gigabit Network Adapter
+       1064  Gigabit Network Adapter
+               1737 0016  EG1064 v2 Instant Gigabit Network Adapter
 173b  Altima (nee Broadcom)
        03e8  AC1000 Gigabit Ethernet
+       03e9  AC1001 Gigabit Ethernet
        03ea  AC9100 Gigabit Ethernet
+               173b 0001  AC1002
+       03eb  AC1003 Gigabit Ethernet
 1743  Peppercon AG
        8139  ROL/F-100 Fast Ethernet Adapter with ROL
 174b  PC Partner Limited
 175e  Sanera Systems, Inc.
+1787  Hightech Information System Ltd.
 # also used by Struck Innovative Systeme for joint developments
 1796  Research Centre Juelich
        0001  SIS1100 [Gigabit link]
        0004  CAMAC Controller
        0005  PROFIBUS
        0006  AMCC HOTlink
+1799  Belkin
+17af  Hightech Information System Ltd.
+17cc  NetChip Technology, Inc
+       2280  USB 2.0
 1813  Ambient Technologies Inc
+       4000  HaM controllerless modem
+               16be 0001  V9x HAM Data Fax Modem
+       4100  HaM plus Data Fax Modem
+               16be 0002  V9x HAM 1394
+1851  Microtune, Inc.
+1852  Anritsu Corp.
+1888  Varisys Ltd
+       0301  VMFX1 FPGA PMC module
+       0601  VSM2 dual PMC carrier
+       0710  VS14x series PowerPC PCI board
+       0720  VS24x series PowerPC PCI board
 1a08  Sierra semiconductor
        0000  SC15064
 1b13  Jaton Corp
        2020  DC-390
        690c  690c
        dc29  DC290
+1fc0  Tumsan Oy
+       0300  E2200 Dual E1/Rawpipe Card
+2000  Smart Link Ltd.
 2001  Temporal Research Ltd
+2003  Smart Link Ltd.
+2004  Smart Link Ltd.
 21c3  21st Century Computer Corp.
 2348  Racore
        2010  8142 100VG/AnyLAN
 3000  Hansol Electronics Inc.
 3142  Post Impression Systems.
 3388  Hint Corp
+       0013  HiNT HC4 PCI to ISDN bridge, Multimedia audio controller
+       0014  HiNT HC4 PCI to ISDN bridge, Network controller
        0021  HB1-SE33 PCI-PCI Bridge
+       101a  E.Band [AudioTrak Inca88]
+       101b  E.Band [AudioTrak Inca88]
        8011  VXPro II Chipset
                3388 8011  VXPro II Chipset CPU to PCI Bridge
        8012  VXPro II Chipset
                3d3d 0127  Permedia3 Create!
        000a  GLINT R3
                3d3d 0121  Oxygen VX1
+       000c  GLINT R3 [Oxygen VX1]
+               3d3d 0144  Oxygen VX1-4X AGP [Permedia 4]
        0100  Permedia II 2D+3D
        1004  Permedia
        3d04  Permedia
        0100  AladdinCARD
        0200  CPC
 4444  Internext Compression Inc
+       0803  iTVC15 MPEG-2 Encoder
 4468  Bridgeport machines
 4594  Cogetec Informatique Inc
 45fb  Baldor Electric Company
 5143  Qualcomm Inc
 5145  Ensoniq (Old)
        3031  Concert AudioPCI
+5168  Animation Technologies Inc.
 5301  Alliance Semiconductor Corp.
        0001  ProMotion aT3D
 5333  S3 Inc.
        8c10  86C270-294 Savage/MX-MV
        8c11  82C270-294 Savage/MX
        8c12  86C270-294 Savage/IX-MV
+               1014 017f  ThinkPad T20
        8c13  86C270-294 Savage/IX
+               1179 0001  Magnia Z310
        8c22  SuperSavage MX/128
        8c24  SuperSavage MX/64
        8c26  SuperSavage MX/64C
        8c2e  SuperSavage IX/C SDR
                1014 01fc  ThinkPad T23 (2647-4MG)
        8c2f  SuperSavage IX/C DDR
-# Integrated in VIA ProSavage PN133 North Bridge
-       8d01  VT8603 [ProSavage PN133] AGP4X VGA Controller (Twister)
+       8d01  86C380 [ProSavageDDR K4M266]
        8d02  VT8636A [ProSavage KN133] AGP4X VGA Controller (TwisterK)
-       8d04  VT8751 [ProSavageDDR P4M266] VGA Controller
+       8d03  VT8751 [ProSavageDDR P4M266]
+       8d04  VT8375 [ProSavage8 KM266/KL266]
        9102  86C410 Savage 2000
                1092 5932  Viper II Z200
                1092 5934  Viper II Z200
                1092 5a57  Viper II Z200
        ca00  SonicVibes
 544c  Teralogic Inc
+       0350  TL880-based HDTV/ATSC tuner
 5455  Technische University Berlin
        4458  S5933
 5519  Cnet Technologies, Inc.
        0001  I-30xx Scanner Interface
 5555  Genroco, Inc
        0003  TURBOstor HFP-832 [HiPPI NIC]
+5654  VoiceTronix Pty Ltd
 5700  Netpower
 6356  UltraStor
 6374  c't Magazin für Computertechnik
                0e11 b123  NC1634 Gigabit Ethernet Adapter (1000-SX)
                1014 0119  Netfinity Gigabit Ethernet SX Adapter
                8086 1000  PRO/1000 Gigabit Server Adapter
-       1001  82543GC Gigabit Ethernet Controller
+       1001  82543GC Gigabit Ethernet Controller (Fiber)
                0e11 004a  NC6136 Gigabit Server Adapter
                1014 01ea  Netfinity Gigabit Ethernet SX Adapter
                8086 1003  PRO/1000 F Server Adapter
                8086 200e  Pro 100 LAN+Modem 56 Cardbus II
                8086 2013  Pro 100 SR Mobile Combo Adapter
                8086 2017  Pro 100 S Combo Mobile Adapter
-       1004  82543GC Gigabit Ethernet Controller
+       1004  82543GC Gigabit Ethernet Controller (Copper)
                0e11 0049  NC7132 Gigabit Upgrade Module
                0e11 b1a4  NC7131 Gigabit Server Adapter
                1014 10f2  Gigabit Ethernet Server Adapter
                8086 1004  PRO/1000 T Server Adapter
                8086 2004  PRO/1000 T Server Adapter
-       1008  82544EI Gigabit Ethernet Controller
+       1008  82544EI Gigabit Ethernet Controller (Copper)
                8086 1107  PRO/1000 XT Server Adapter
                8086 2107  PRO/1000 XT Server Adapter
                8086 2110  PRO/1000 XT Server Adapter
-       1009  82544EI Gigabit Ethernet Controller
+       1009  82544EI Gigabit Ethernet Controller (Fiber)
                8086 1109  PRO/1000 XF Server Adapter
                8086 2109  PRO/1000 XF Server Adapter
-       100c  82544GC Gigabit Ethernet Controller
+       100c  82544GC Gigabit Ethernet Controller (Copper)
                8086 1112  PRO/1000 T Desktop Adapter
                8086 2112  PRO/1000 T Desktop Adapter
-       100d  82544GC Gigabit Ethernet Controller
+       100d  82544GC Gigabit Ethernet Controller (LOM)
        100e  82540EM Gigabit Ethernet Controller
                8086 001e  PRO/1000 MT Desktop Adapter
                8086 002e  PRO/1000 MT Desktop Adapter
-       100f  82545EM Gigabit Ethernet Controller
+       100f  82545EM Gigabit Ethernet Controller (Copper)
                8086 1001  PRO/1000 MT Server Adapter
-       1010  82546EB Gigabit Ethernet Controller
+       1010  82546EB Gigabit Ethernet Controller (Copper)
                8086 1011  PRO/1000 MT Dual Port Server Adapter
-       1011  82545EM Gigabit Ethernet Controller
+       1011  82545EM Gigabit Ethernet Controller (Fiber)
                8086 1002  PRO/1000 MF Server Adapter
-       1012  82546EB Gigabit Ethernet Controller
+       1012  82546EB Gigabit Ethernet Controller (Fiber)
                8086 1012  PRO/1000 MF Dual Port Server Adapter
+       1015  82540EM Gigabit Ethernet Controller (LOM)
        1029  82559 Ethernet Controller
        1030  82559 InBusiness 10/100
        1031  82801CAM (ICH3) PRO/100 VE (LOM) Ethernet Controller
-               1014 0209  ThinkPad A30p (2653-64G)
+               1014 0209  ThinkPad A/T/X Series
                104d 80e7  Vaio PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
                107b 5350  EtherExpress PRO/100 VE
                1179 0001  EtherExpress PRO/100 VE
                144d c000  EtherExpress PRO/100 VE
                144d c001  EtherExpress PRO/100 VE
                144d c003  EtherExpress PRO/100 VE
+               144d c006  vpr Matrix 170B4
        1032  82801CAM (ICH3) PRO/100 VE Ethernet Controller
        1033  82801CAM (ICH3) PRO/100 VM (LOM) Ethernet Controller
        1034  82801CAM (ICH3) PRO/100 VM Ethernet Controller
        103c  82801BD PRO/100 VM (CNR) Ethernet Controller
        103d  82801BD PRO/100 VE (MOB) Ethernet Controller
        103e  82801BD PRO/100 VM (MOB) Ethernet Controller
+       1040  536EP Data Fax Modem
+               16be 1040  V.9X DSP Data Fax Modem
+       1043  PRO/Wireless LAN 2100 3B Mini PCI Adapter
        1059  82551QM Ethernet Controller
        1130  82815 815 Chipset Host Bridge and Memory Controller Hub
+               1025 1016  Travelmate 612 TX
                1043 8027  TUSL2-C Mainboard
                104d 80df  Vaio PCG-FX403
+               8086 4532  D815EEA2 mainboard
+               8086 4557  D815EGEW Mainboard
        1131  82815 815 Chipset AGP Bridge
        1132  82815 CGC [Chipset Graphics Controller]
                1025 1016  Travelmate 612 TX
                104d 80df  Vaio PCG-FX403
+               8086 4532  D815EEA2 Mainboard
+               8086 4557  D815EGEW Mainboard
        1161  82806AA PCI64 Hub Advanced Programmable Interrupt Controller
                8086 1161  82806AA PCI64 Hub APIC
+       1162  Xscale 80200 Big Endian Companion Chip
        1200  Intel IXP1200 Network Processor
                172a 0000  AEP SSL Accelerator
        1209  82559ER
                1014 01f2  10/100 Ethernet Server Adapter
                1014 0207  Ethernet Pro/100 S
                1014 0232  10/100 Dual Port Server Adapter
+               1014 023a  ThinkPad R30
                1014 105c  Netfinity 10/100
+               1014 2205  ThinkPad A22p
                1014 305c  10/100 EtherJet Management Adapter
                1014 405c  10/100 EtherJet Adapter with Alert on LAN
                1014 505c  10/100 EtherJet Secure Management Adapter
                1014 605c  10/100 EtherJet Secure Management Adapter
                1014 705c  10/100 Netfinity 10/100 Ethernet Security Adapter
                1014 805c  10/100 Netfinity 10/100 Ethernet Security Adapter
+               1028 009b  PowerEdge 2550
                1033 8000  PC-9821X-B06
                1033 8016  PK-UG-X006
                1033 801f  PK-UG-X006
                8086 8000  82806AA PCI64 Hub Controller (HRes)
        1460  82870P2 P64H2 Hub PCI Bridge
        1461  82870P2 P64H2 I/OxAPIC
+               15d9 3480  P4DP6
        1462  82870P2 P64H2 Hot Plug Controller
        1960  80960RP [i960RP Microprocessor]
                101e 0431  MegaRAID 431 RAID Controller
        2428  82801AB PCI Bridge
        2440  82801BA ISA Bridge (LPC)
        2442  82801BA/BAM USB (Hub #1)
+               1014 01c6  Netvista A40/A40p
+               1025 1016  Travelmate 612 TX
                104d 80df  Vaio PCG-FX403
                147b 0507  TH7II-RAID
+               8086 4532  D815EEA2 mainboard
+               8086 4557  D815EGEW Mainboard
        2443  82801BA/BAM SMBus
+               1014 01c6  Netvista A40/A40p
+               1025 1016  Travelmate 612 TX
                1043 8027  TUSL2-C Mainboard
                104d 80df  Vaio PCG-FX403
                147b 0507  TH7II-RAID
+               8086 4532  D815EEA2 mainboard
+               8086 4557  D815EGEW Mainboard
        2444  82801BA/BAM USB (Hub #2)
+               1025 1016  Travelmate 612 TX
                104d 80df  Vaio PCG-FX403
                147b 0507  TH7II-RAID
+               8086 4532  D815EEA2 mainboard
        2445  82801BA/BAM AC'97 Audio
+               1014 01c6  Netvista A40/A40p
+               1025 1016  Travelmate 612 TX
                104d 80df  Vaio PCG-FX403
                1462 3370  STAC9721 AC
                147b 0507  TH7II-RAID
-       2446  82801BA/BAM AC'97 Modem
+               8086 4557  D815EGEW Mainboard
+       2446  Intel 537 [82801BA/BAM AC'97 Modem]
+               1025 1016  Travelmate 612 TX
                104d 80df  Vaio PCG-FX403
        2448  82801BAM/CAM PCI Bridge
        2449  82801BA/BAM/CA/CAM Ethernet Controller
                1014 023d  EtherExpress PRO/100 VE
                1014 0244  EtherExpress PRO/100 VE
                1014 0245  EtherExpress PRO/100 VE
+               1014 0265  PRO/100 VE Desktop Connection
+               1014 0267  PRO/100 VE Desktop Connection
+               1014 026a  PRO/100 VE Desktop Connection
                109f 315d  EtherExpress PRO/100 VE
                109f 3181  EtherExpress PRO/100 VE
+               1179 ff01  PRO/100 VE Network Connection
                1186 7801  EtherExpress PRO/100 VE
                144d 2602  HomePNA 1M CNR
                8086 3010  EtherExpress PRO/100 VE
                1025 1016  Travelmate 612TX
                104d 80df  Vaio PCG-FX403
        244b  82801BA IDE U100
+               1014 01c6  Netvista A40/A40p
                1043 8027  TUSL2-C Mainboard
                147b 0507  TH7II-RAID
+               8086 4532  D815EEA2 mainboard
+               8086 4557  D815EGEW Mainboard
        244c  82801BAM ISA Bridge (LPC)
-       244e  82801BA/CA/DB PCI Bridge
+       244e  82801BA/CA/DB/EB PCI Bridge
        2450  82801E ISA Bridge (LPC)
        2452  82801E USB
        2453  82801E SMBus
        245b  82801E IDE U100
        245d  82801E Ethernet Controller 1
        245e  82801E PCI Bridge
-       2480  82801CA ISA Bridge (LPC)
+       2480  82801CA LPC Interface Controller
        2482  82801CA/CAM USB (Hub #1)
-               1014 0220  ThinkPad T23 (2647-4MG) or A30p (2653-64G)
+               1014 0220  ThinkPad A/T/X Series
                104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
-       2483  82801CA/CAM SMBus
-               1014 0220  ThinkPad T23 (2647-4MG) or A30p (2653-64G)
+               15d9 3480  P4DP6
+               8086 1958  vpr Matrix 170B4
+       2483  82801CA/CAM SMBus Controller
+               1014 0220  ThinkPad A/T/X Series
                104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
+               15d9 3480  P4DP6
+               8086 1958  vpr Matrix 170B4
        2484  82801CA/CAM USB (Hub #2)
-               1014 0220  ThinkPad T23 (2647-4MG) or A30p (2653-64G)
+               1014 0220  ThinkPad A/T/X Series
                104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
-       2485  82801CA/CAM AC'97 Audio
-               1014 0222  ThinkPad T23 (2647-4MG)
+               15d9 3480  P4DP6
+               8086 1958  vpr Matrix 170B4
+       2485  82801CA/CAM AC'97 Audio Controller
+               1014 0222  ThinkPad T23 (2647-4MG) or A30p (2653-64G)
+               1014 0508  ThinkPad T30
+               1014 051c  ThinkPad A/T/X Series
                104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
-       2486  82801CA/CAM AC'97 Modem
-               1014 0223  ThinkPad A30p (2653-64G)
+               144d c006  vpr Matrix 170B4
+       2486  82801CA/CAM AC'97 Modem Controller
+               1014 0223  ThinkPad A/T/X Series
                1014 0503  ThinkPad R31 2656BBG
+               1014 051a  ThinkPad A/T/X Series
                104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
+               1179 0001  Toshiba Satellite 1110 Z15 internal Modem
                134d 4c21  Dell Inspiron 2100 internal modem
+               144d 2115  vpr Matrix 170B4 internal modem
+               14f1 5421  MD56ORD V.92 MDC Modem
        2487  82801CA/CAM USB (Hub #3)
-               1014 0220  ThinkPad T23 (2647-4MG) or A30p (2653-64G)
+               1014 0220  ThinkPad A/T/X Series
                104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
+               15d9 3480  P4DP6
+               8086 1958  vpr Matrix 170B4
        248a  82801CAM IDE U100
-               1014 0220  ThinkPad T23 (2647-4MG) or A30p (2653-64G)
+               1014 0220  ThinkPad A/T/X Series
                104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
-       248b  82801CA IDE U100
+               8086 1958  vpr Matrix 170B4
+       248b  82801CA Ultra ATA Storage Controller
+               15d9 3480  P4DP6
        248c  82801CAM ISA Bridge (LPC)
-       24c0  82801DB ISA Bridge (LPC)
+       24c0  82801DB LPC Interface Controller
+               1462 5800  845PE Max (MS-6580)
        24c2  82801DB USB (Hub #1)
-       24c3  82801DB SMBus
+               1462 5800  845PE Max (MS-6580)
+       24c3  82801DB/DBM SMBus Controller
+               1462 5800  845PE Max (MS-6580)
        24c4  82801DB USB (Hub #2)
-       24c5  82801DB AC'97 Audio
-       24c6  82801DB AC'97 Modem
+               1462 5800  845PE Max (MS-6580)
+       24c5  82801DB AC'97 Audio Controller
+               1462 5800  845PE Max (MS-6580)
+       24c6  82801DB AC'97 Modem Controller
        24c7  82801DB USB (Hub #3)
-       24cb  82801DB ICH4 IDE
-       24cd  82801DB USB EHCI Controller
+               1462 5800  845PE Max (MS-6580)
+       24ca  82801DBM Ultra ATA Storage Controller
+       24cb  82801DB Ultra ATA Storage Controller
+               1462 5800  845PE Max (MS-6580)
+       24cc  82801DBM LPC Interface Controller
+       24cd  82801DB USB2
+               1462 3981  845PE Max (MS-6580) Onboard USB EHCI Controller
+       24d0  82801EB LPC Interface Controller
+       24d1  82801EB Ultra ATA Storage Controller
+       24d2  82801EB USB
+       24d3  82801EB SMBus Controller
+       24d4  82801EB USB
+       24d5  82801EB AC'97 Audio Controller
+       24d6  82801EB AC'97 Modem Controller
+       24d7  82801EB USB
+       24db  82801EB Ultra ATA Storage Controller
+       24dc  82801EB LPC Interface Controller
+       24dd  82801EB USB2
+       24de  82801EB USB
        2500  82820 820 (Camino) Chipset Host Bridge (MCH)
                1028 0095  Precision Workstation 220 Chipset
                1043 801c  P3C-2000 system chipset
        2532  82850 850 (Tehama) Chipset AGP Bridge
        2533  82860 860 (Wombat) Chipset AGP Bridge
        2534  82860 860 (Wombat) Chipset PCI Bridge
-       2540  e7500 [Plumas] DRAM Controller
-       2541  e7500 [Plumas] DRAM Controller Error Reporting
-       2543  e7500 [Plumas] HI_B Virtual PCI Bridge (F0)
-       2544  e7500 [Plumas] HI_B Virtual PCI Bridge (F1)
-       2545  e7500 [Plumas] HI_C Virtual PCI Bridge (F0)
-       2546  e7500 [Plumas] HI_C Virtual PCI Bridge (F1)
-       2547  e7500 [Plumas] HI_D Virtual PCI Bridge (F0)
-       2548  e7500 [Plumas] HI_D Virtual PCI Bridge (F1)
+       2540  E7500 Memory Controller Hub
+               15d9 3480  P4DP6
+       2541  E7000 Series Host RASUM Controller
+               15d9 3480  P4DP6
+       2543  E7000 Series Hub Interface B PCI-to-PCI Bridge
+       2544  E7000 Series Hub Interface B RASUM Controller
+       2545  E7000 Series Hub Interface C PCI-to-PCI Bridge
+       2546  E7000 Series Hub Interface C RASUM Controller
+       2547  E7000 Series Hub Interface D PCI-to-PCI Bridge
+       2548  E7000 Series Hub Interface D RASUM Controller
+       254c  E7501 Memory Controller Hub
+       2550  E7505 Memory Controller Hub
+       2551  E7000 Series RAS Controller
+       2552  E7000 Series Processor to AGP Controller
+       2553  E7000 Series Hub Interface B PCI-to-PCI Bridge
+       2554  E7000 Series Hub Interface B PCI-to-PCI Bridge RAS Controller
+       255d  E7205 Memory Controller Hub
        2560  82845G/GL [Brookdale-G] Chipset Host Bridge
+               1462 5800  845PE Max (MS-6580)
        2561  82845G/GL [Brookdale-G] Chipset AGP Bridge
        2562  82845G/GL [Brookdale-G] Chipset Integrated Graphics Device
+       2570  82865G/PE/P Processor to I/O Controller
+       2571  82865G/PE/P Processor to AGP Controller
+       2572  82865G Integrated Graphics Device
+       2573  82865G/PE/P Processor to PCI to CSA Bridge
+       2576  82864G/PE/P Processor to I/O Memory Interface
+       2578  82875P Memory Controller Hub
+       2579  82875P Processor to AGP Controller
+       257b  82875P Processor to PCI to CSA Bridge
+       257e  82875P Processor to I/O Memory Interface
        3092  Integrated RAID
+       3340  82855PM Processor to I/O Controller
+       3341  82855PM Processor to AGP Controller
        3575  82830 830 Chipset Host Bridge
-               1014 021d  ThinkPad T23 (2647-4MG) or A30p (2653-64G)
+               1014 021d  ThinkPad A/T/X Series
                104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
        3576  82830 830 Chipset AGP Bridge
        3577  82830 CGC [Chipset Graphics Controller]
+               1014 0513  ThinkPad A/T/X Series
        3578  82830 830 Chipset Host Bridge
+       3580  82852/855GM Host Bridge
+       3582  82852/855GM Integrated Graphics Device
        5200  EtherExpress PRO/100 Intelligent Server
        5201  EtherExpress PRO/100 Intelligent Server
                8086 0001  EtherExpress PRO/100 Server Ethernet Adapter
        7113  82371AB/EB/MB PIIX4 ACPI
        7120  82810 GMCH [Graphics Memory Controller Hub]
        7121  82810 CGC [Chipset Graphics Controller]
+               8086 4341  Cayman (CA810) Mainboard
        7122  82810 DC-100 GMCH [Graphics Memory Controller Hub]
        7123  82810 DC-100 CGC [Chipset Graphics Controller]
        7124  82810E DC-133 GMCH [Graphics Memory Controller Hub]
        7181  440LX/EX - 82443LX/EX AGP bridge
        7190  440BX/ZX/DX - 82443BX/ZX/DX Host bridge
                0e11 0500  Armada 1750 Laptop System Chipset
+               0e11 b110  Armada M700
                1179 0001  Toshiba Tecra 8100 Laptop System Chipset
        7191  440BX/ZX/DX - 82443BX/ZX/DX AGP bridge
        7192  440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled)
        7478  AHA-2944/2944W / AIC-7874
        7578  AHA-3944/3944W / AIC-7875
        7678  AHA-4944W/UW / AIC-7876
+       7710  ANA-7711F Network Accelerator Card (NAC) - Optical
+       7711  ANA-7711C Network Accelerator Card (NAC) - Copper
        7778  AIC-787x
        7810  AIC-7810
        7815  AIC-7815 RAID+Memory Controller IC
                9005 62a1  19160 Ultra160 SCSI Controller
        0083  AIC-7892D U160/m
        008f  AIC-7892P U160/m
+               1179 0001  Magnia Z310
+               15d9 9005  Onboard SCSI Host Adapter
        00c0  AHA-3960D / AIC-7899A U160/m
                0e11 f620  Compaq 64-Bit/66MHz Dual Channel Wide Ultra3 SCSI Adapter
                9005 f620  AHA-3960D U160/m
        00c1  AIC-7899B U160/m
        00c3  AIC-7899D U160/m
        00c5  RAID subsystem HBA
+               1028 00c5  PowerEdge 2550
        00cf  AIC-7899P U160/m
+               1028 00d1  PowerEdge 2550
+               10f1 2462  Thunder K7 S2462
+               15d9 9005  Onboard SCSI Host Adapter
+       0250  ServeRAID Controller
+               1014 0279  ServeRAID-xx
+               1014 028c  ServeRAID-xx
        0285  AAC-RAID
                1028 0287  PowerEdge Expandable RAID Controller 320/DC
+       8000  ASC-29320A U320
+       800f  AIC-7901 U320
+       8010  ASC-39320 U320
+       8011  ASC-32320D U320
+               0e11 00ac  U320
+               9005 0041  ASC-39320D U320
+       8012  ASC-29320 U320
+       8013  ASC-29320B U320
+       8014  ASC-29320LP U320
+       801e  AIC-7901A U320
+       801f  AIC-7902 U320
+       8080  ASC-29320A U320 w/HostRAID
+       808f  AIC-7901 U320 w/HostRAID
+       8090  ASC-39320 U320 w/HostRAID
+       8091  ASC-39320D U320 w/HostRAID
+       8092  ASC-29320 U320 w/HostRAID
+       8093  ASC-29320B U320 w/HostRAID
+       8094  ASC-29320LP U320 w/HostRAID
+       8095  ASC-39320(B) U320 w/HostRAID
+       8096  ASC-39320A U320 w/HostRAID
+       8097  ASC-29320ALP U320 w/HostRAID
+       809c  ASC-39320D(B) U320 w/HostRAID
+       809d  AIC-7902(B) U320 w/HostRAID
+       809e  AIC-7901A U320 w/HostRAID
+       809f  AIC-7902 U320 w/HostRAID
 907f  Atronics
        2015  IDE-2015PL
 919a  Gigapixel Corp
@@ -6581,6 +7280,8 @@ a727  3Com Corporation
 aa42  Scitex Digital Video
 ac1e  Digital Receiver Technology Inc
 b1b3  Shiva Europe Limited
+# Pinnacle should be 11bd, but they got it wrong several times --mj
+bd11  Pinnacle Systems, Inc. (Wrong ID)
 c001  TSI Telsys
 c0a9  Micron/Crucial Technology
 c0de  Motorola
@@ -6588,6 +7289,9 @@ c0fe  Motion Engineering, Inc.
 ca50  Varian Australia Pty Ltd
 cafe  Chrysalis-ITS
 cccc  Catapult Communications
+cddd  Tyzx, Inc.
+       0101  DeepSea 1 High Speed Stereo Vision Frame Grabber
+       0200  DeepSea 2 High Speed Stereo Vision Frame Grabber
 d4d4  Dy4 Systems Inc
        0601  PCI Mezzanine Card
 d531  I+ME ACTIA GmbH
@@ -6596,12 +7300,17 @@ dead  Indigita Corporation
 e000  Winbond
        e000  W89C940
 e159  Tiger Jet Network Inc.
-       0001  Model 300 128k
+       0001  Intel 537
                0059 0001  128k ISDN-S/T Adapter
                0059 0003  128k ISDN-U Adapter
        0002  Tiger100APC ISDN chipset
 e4bf  EKF Elektronik GmbH
 ea01  Eagle Technology
+# The main chip of all these devices is by Xilinx -> It could also be a Xilinx ID.
+ea60  RME
+       9896  Digi32
+       9897  Digi32 Pro
+       9898  Digi32/8
 eabb  Aashima Technology B.V.
 eace  Endace Measurement Systems, Ltd
        3100  DAG 3.10 OC-3/OC-12
@@ -6617,15 +7326,29 @@ eace  Endace Measurement Systems, Ltd
        422e  DAG 4.2E Dual Gigabit Ethernet
 ec80  Belkin Corporation
        ec00  F5D6000
-ecc0  Echo Corporation
+ecc0  Echo Digital Audio Corporation
+       0050  Gina24_301
+       0051  Gina24_361
+       0060  Layla24
+       0070  Mona_301_80
+       0071  Mona_301_66
+       0072  Mona_361
+       0080  Mia
 edd8  ARK Logic Inc
        a091  1000PV [Stingray]
        a099  2000PV [Stingray]
        a0a1  2000MT
        a0a9  2000MI
+f1d0  AJA Video
+# All boards I have seen have this ID not efac, though all docs say efac...
+       cafe  KONA SD SMPTE 259M I/O
+       efac  KONA SD SMPTE 259M I/O
+       facd  KONA HD SMPTE 292M I/O
 fa57  Fast Search & Transfer ASA
 febd  Ultraview Corp.
-feda  Epigram Inc
+feda  Broadcom Inc (nee Epigram)
+       a0fa  BCM4210 iLine10 HomePNA 2.0
+       a10e  BCM4230 iLine10 HomePNA 2.0
 fffe  VMWare Inc
        0710  Virtual SVGA
 ffff  Illegal Vendor ID
index b20acce3f2f7fa647aa0ff63cb69452aae35bb11..4e920c52344e10e85f8bb9bd28ca8332c8bf4b91 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <xen/config.h>
 #include <xen/types.h>
-#include <xen/lib.h>
+#include <xen/kernel.h>
 #include <xen/pci.h>
 #include <xen/init.h>
 #include <xen/delay.h>
@@ -234,7 +234,6 @@ static void __init quirk_io_region(struct pci_dev *dev, unsigned region, unsigne
 static void __devinit quirk_ati_exploding_mce(struct pci_dev *dev)
 {
        printk(KERN_INFO "ATI Northbridge, reserving I/O ports 0x3b0 to 0x3bb.\n");
-       /* Mae rhaid in i beidio a edrych ar y lleoliad I/O hyn */
        request_region(0x3b0, 0x0C, "RadeonIGP");
        request_region(0x3d3, 0x01, "RadeonIGP");
 }
@@ -275,6 +274,22 @@ static void __init quirk_piix4_acpi(struct pci_dev *dev)
        quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1);
 }
 
+/*
+ * ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at
+ *     0x40 (128 bytes of ACPI, GPIO & TCO registers)
+ *     0x58 (64 bytes of GPIO I/O space)
+ */
+static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev)
+{
+       u32 region;
+
+       pci_read_config_dword(dev, 0x40, &region);
+       quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES);
+
+       pci_read_config_dword(dev, 0x58, &region);
+       quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1);
+}
+
 /*
  * VIA ACPI: One IO region pointed to by longword at
  *     0x48 or 0x20 (256 bytes of ACPI registers)
@@ -316,7 +331,6 @@ static void __init quirk_vt82c686_acpi(struct pci_dev *dev)
 
 
 #ifdef CONFIG_X86_IO_APIC 
-extern int nr_ioapics;
 
 /*
  * VIA 686A/B: If an IO-APIC is active, we need to route all on-chip
@@ -484,6 +498,31 @@ static void __init quirk_amd_ordering(struct pci_dev *dev)
        }
 }
 
+#ifdef CONFIG_X86_IO_APIC
+
+#define AMD8131_revA0        0x01
+#define AMD8131_revB0        0x11
+#define AMD8131_MISC         0x40
+#define AMD8131_NIOAMODE_BIT 0
+
+static void __init quirk_amd_8131_ioapic(struct pci_dev *dev) 
+{ 
+       unsigned char revid, tmp;
+       
+       if (nr_ioapics == 0) 
+               return;
+
+       pci_read_config_byte(dev, PCI_REVISION_ID, &revid);
+       if (revid == AMD8131_revA0 || revid == AMD8131_revB0) {
+               printk(KERN_INFO "Fixing up AMD8131 IOAPIC mode\n"); 
+               pci_read_config_byte( dev, AMD8131_MISC, &tmp);
+               tmp &= ~(1 << AMD8131_NIOAMODE_BIT);
+               pci_write_config_byte( dev, AMD8131_MISC, tmp);
+       }
+} 
+#endif
+
+
 /*
  *     DreamWorks provided workaround for Dunord I-3000 problem
  *
@@ -572,6 +611,113 @@ static void __devinit quirk_ide_bases(struct pci_dev *dev)
               first_bar, last_bar, dev->slot_name);
 }
 
+/*
+ *     Ensure C0 rev restreaming is off. This is normally done by
+ *     the BIOS but in the odd case it is not the results are corruption
+ *     hence the presence of a Linux check
+ */
+static void __init quirk_disable_pxb(struct pci_dev *pdev)
+{
+       u16 config;
+       u8 rev;
+       
+       pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
+       if(rev != 0x04)         /* Only C0 requires this */
+               return;
+       pci_read_config_word(pdev, 0x40, &config);
+       if(config & (1<<6))
+       {
+               config &= ~(1<<6);
+               pci_write_config_word(pdev, 0x40, config);
+               printk(KERN_INFO "PCI: C0 revision 450NX. Disabling PCI restreaming.\n");
+       }
+}
+
+/*
+ *     VIA northbridges care about PCI_INTERRUPT_LINE
+ */
+int interrupt_line_quirk;
+
+static void __init quirk_via_bridge(struct pci_dev *pdev)
+{
+       if(pdev->devfn == 0)
+               interrupt_line_quirk = 1;
+}
+       
+/* 
+ *     Serverworks CSB5 IDE does not fully support native mode
+ */
+static void __init quirk_svwks_csb5ide(struct pci_dev *pdev)
+{
+       u8 prog;
+       pci_read_config_byte(pdev, PCI_CLASS_PROG, &prog);
+       if (prog & 5) {
+               prog &= ~5;
+               pdev->class &= ~5;
+               pci_write_config_byte(pdev, PCI_CLASS_PROG, prog);
+               /* need to re-assign BARs for compat mode */
+               quirk_ide_bases(pdev);
+       }
+}
+
+/*
+ * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge
+ * is not activated. The myth is that Asus said that they do not want the
+ * users to be irritated by just another PCI Device in the Win98 device
+ * manager. (see the file prog/hotplug/README.p4b in the lm_sensors 
+ * package 2.7.0 for details)
+ *
+ * The SMBus PCI Device can be activated by setting a bit in the ICH LPC 
+ * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it 
+ * becomes necessary to do this tweak in two steps -- I've chosen the Host
+ * bridge as trigger.
+ */
+
+static int __initdata asus_hides_smbus = 0;
+
+static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
+{
+       if (likely(dev->subsystem_vendor != PCI_VENDOR_ID_ASUSTEK))
+               return;
+
+       if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB)
+               switch(dev->subsystem_device) {
+               case 0x8070: /* P4B */
+               case 0x8088: /* P4B533 */
+                       asus_hides_smbus = 1;
+               }
+       if ((dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) &&
+           (dev->subsystem_device == 0x80b2)) /* P4PE */
+               asus_hides_smbus = 1;
+       if ((dev->device == PCI_DEVICE_ID_INTEL_82850_HB) &&
+           (dev->subsystem_device == 0x8030)) /* P4T533 */
+               asus_hides_smbus = 1;
+       if ((dev->device == PCI_DEVICE_ID_INTEL_7205_0) &&
+           (dev->subsystem_device == 0x8070)) /* P4G8X Deluxe */
+               asus_hides_smbus = 1;
+       return;
+}
+
+static void __init asus_hides_smbus_lpc(struct pci_dev *dev)
+{
+       u16 val;
+       
+       if (likely(!asus_hides_smbus))
+               return;
+
+       pci_read_config_word(dev, 0xF2, &val);
+       if (val & 0x8) {
+               pci_write_config_word(dev, 0xF2, val & (~0x8));
+               pci_read_config_word(dev, 0xF2, &val);
+               if(val & 0x8)
+                       printk(KERN_INFO "PCI: i801 SMBus device continues to play 'hide and seek'! 0x%x\n", val);
+               else
+                       printk(KERN_INFO "PCI: Enabled i801 SMBus device\n");
+       }
+}
+
 /*
  *  The main table of quirks.
  */
@@ -587,6 +733,7 @@ static struct pci_fixup pci_fixups[] __initdata = {
        { PCI_FIXUP_FINAL,      PCI_VENDOR_ID_VIA,      PCI_DEVICE_ID_VIA_82C586_0,     quirk_isa_dma_hangs },
        { PCI_FIXUP_FINAL,      PCI_VENDOR_ID_VIA,      PCI_DEVICE_ID_VIA_82C596,       quirk_isa_dma_hangs },
        { PCI_FIXUP_FINAL,      PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82371SB_0,  quirk_isa_dma_hangs },
+       { PCI_FIXUP_FINAL,      PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82454NX,    quirk_disable_pxb },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_S3,       PCI_DEVICE_ID_S3_868,           quirk_s3_64M },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_S3,       PCI_DEVICE_ID_S3_968,           quirk_s3_64M },
        { PCI_FIXUP_FINAL,      PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82437,      quirk_triton }, 
@@ -612,10 +759,12 @@ static struct pci_fixup pci_fixups[] __initdata = {
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_VIA,      PCI_DEVICE_ID_VIA_82C586_3,     quirk_vt82c586_acpi },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_VIA,      PCI_DEVICE_ID_VIA_82C686_4,     quirk_vt82c686_acpi },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82371AB_3,  quirk_piix4_acpi },
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82801DB_12, quirk_ich4_lpc_acpi },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_AL,       PCI_DEVICE_ID_AL_M7101,         quirk_ali7101_acpi },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82371SB_2,  quirk_piix3_usb },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82371AB_2,  quirk_piix3_usb },
        { PCI_FIXUP_HEADER,     PCI_ANY_ID,             PCI_ANY_ID,                     quirk_ide_bases },
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_VIA,      PCI_ANY_ID,                     quirk_via_bridge },
        { PCI_FIXUP_FINAL,      PCI_ANY_ID,             PCI_ANY_ID,                     quirk_cardbus_legacy },
 
 #ifdef CONFIG_X86_IO_APIC 
@@ -637,9 +786,27 @@ static struct pci_fixup pci_fixups[] __initdata = {
         * instead of 0x01.
         */
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82380FB,    quirk_transparent_bridge },
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_TOSHIBA,  0x605,                          quirk_transparent_bridge },
 
        { PCI_FIXUP_FINAL,      PCI_VENDOR_ID_CYRIX,    PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master },
 
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, quirk_svwks_csb5ide },
+
+#ifdef CONFIG_X86_IO_APIC
+       { PCI_FIXUP_FINAL,      PCI_VENDOR_ID_AMD,      PCI_DEVICE_ID_AMD_8131_APIC, 
+         quirk_amd_8131_ioapic }, 
+#endif
+
+       /*
+        * on Asus P4B boards, the i801SMBus device is disabled at startup.
+        */
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82845_HB,   asus_hides_smbus_hostbridge },
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82845G_HB,  asus_hides_smbus_hostbridge },
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82850_HB,   asus_hides_smbus_hostbridge },
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_7205_0,     asus_hides_smbus_hostbridge },
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82801DB_0,  asus_hides_smbus_lpc },
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82801BA_0,  asus_hides_smbus_lpc },
+
        { 0 }
 };
 
index a5037669e32b6e74199fe827e73561905ff27d6c..4719c08181ebf08471417b88341c5245a798e404 100644 (file)
  *          tighter packing. Prefetchable range support.
  */
 
-#include <xen/init.h>
-#include <xen/kernel.h>
-#include <xen/pci.h>
-#include <xen/errno.h>
-#include <xen/ioport.h>
-#include <xen/cache.h>
-#include <xen/slab.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/errno.h>
+#include <linux/ioport.h>
+#include <linux/cache.h>
+#include <linux/slab.h>
 
 
 #define DEBUG_CONFIG 1
@@ -299,7 +299,7 @@ pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type)
                                order = 0;
                        /* Exclude ranges with size > align from
                           calculation of the alignment. */
-                       if (size == align)
+                       if (r_size == align)
                                aligns[order] += align;
                        if (order > max_order)
                                max_order = order;
diff --git a/xen/drivers/tables.c b/xen/drivers/tables.c
new file mode 100644 (file)
index 0000000..64a0506
--- /dev/null
@@ -0,0 +1,588 @@
+/*
+ *  acpi_tables.c - ACPI Boot-Time Table Parsing
+ *
+ *  Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ */
+
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/kernel.h>
+#include <xen/sched.h>
+#include <xen/smp.h>
+#include <xen/string.h>
+#include <xen/types.h>
+#include <xen/irq.h>
+#include <xen/errno.h>
+#include <xen/acpi.h>
+/*#include <xen/bootmem.h>*/
+
+#define PREFIX                 "ACPI: "
+
+#define ACPI_MAX_TABLES                256
+
+static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
+       [ACPI_TABLE_UNKNOWN]    = "????",
+       [ACPI_APIC]             = "APIC",
+       [ACPI_BOOT]             = "BOOT",
+       [ACPI_DBGP]             = "DBGP",
+       [ACPI_DSDT]             = "DSDT",
+       [ACPI_ECDT]             = "ECDT",
+       [ACPI_ETDT]             = "ETDT",
+       [ACPI_FADT]             = "FACP",
+       [ACPI_FACS]             = "FACS",
+       [ACPI_OEMX]             = "OEM",
+       [ACPI_PSDT]             = "PSDT",
+       [ACPI_SBST]             = "SBST",
+       [ACPI_SLIT]             = "SLIT",
+       [ACPI_SPCR]             = "SPCR",
+       [ACPI_SRAT]             = "SRAT",
+       [ACPI_SSDT]             = "SSDT",
+       [ACPI_SPMI]             = "SPMI",
+       [ACPI_HPET]             = "HPET",
+};
+
+static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" };
+static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
+
+/* System Description Table (RSDT/XSDT) */
+struct acpi_table_sdt {
+       unsigned long           pa;
+       enum acpi_table_id      id;
+       unsigned long           size;
+} __attribute__ ((packed));
+
+static unsigned long           sdt_pa;         /* Physical Address */
+static unsigned long           sdt_count;      /* Table count */
+
+static struct acpi_table_sdt   sdt_entry[ACPI_MAX_TABLES];
+
+void
+acpi_table_print (
+       struct acpi_table_header *header,
+       unsigned long           phys_addr)
+{
+       char                    *name = NULL;
+
+       if (!header)
+               return;
+
+       /* Some table signatures aren't good table names */
+
+       if (!strncmp((char *) &header->signature,
+               acpi_table_signatures[ACPI_APIC],
+               sizeof(header->signature))) {
+               name = "MADT";
+       }
+       else if (!strncmp((char *) &header->signature,
+               acpi_table_signatures[ACPI_FADT],
+               sizeof(header->signature))) {
+               name = "FADT";
+       }
+       else
+               name = header->signature;
+
+       printk(KERN_INFO PREFIX "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n",
+               name, header->revision, header->oem_id,
+               header->oem_table_id, header->oem_revision,
+               header->asl_compiler_id, header->asl_compiler_revision,
+               (void *) phys_addr);
+}
+
+
+void
+acpi_table_print_madt_entry (
+       acpi_table_entry_header *header)
+{
+       if (!header)
+               return;
+
+       switch (header->type) {
+
+       case ACPI_MADT_LAPIC:
+       {
+               struct acpi_table_lapic *p =
+                       (struct acpi_table_lapic*) header;
+               printk(KERN_INFO PREFIX "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
+                       p->acpi_id, p->id, p->flags.enabled?"enabled":"disabled");
+       }
+               break;
+
+       case ACPI_MADT_IOAPIC:
+       {
+               struct acpi_table_ioapic *p =
+                       (struct acpi_table_ioapic*) header;
+               printk(KERN_INFO PREFIX "IOAPIC (id[0x%02x] address[0x%08x] global_irq_base[0x%x])\n",
+                       p->id, p->address, p->global_irq_base);
+       }
+               break;
+
+       case ACPI_MADT_INT_SRC_OVR:
+       {
+               struct acpi_table_int_src_ovr *p =
+                       (struct acpi_table_int_src_ovr*) header;
+               printk(KERN_INFO PREFIX "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
+                       p->bus, p->bus_irq, p->global_irq,
+                       mps_inti_flags_polarity[p->flags.polarity],
+                       mps_inti_flags_trigger[p->flags.trigger]);
+               if(p->flags.reserved)
+                       printk(KERN_INFO PREFIX "INT_SRC_OVR unexpected reserved flags: 0x%x\n",
+                               p->flags.reserved);
+
+       }
+               break;
+
+       case ACPI_MADT_NMI_SRC:
+       {
+               struct acpi_table_nmi_src *p =
+                       (struct acpi_table_nmi_src*) header;
+               printk(KERN_INFO PREFIX "NMI_SRC (%s %s global_irq %d)\n",
+                       mps_inti_flags_polarity[p->flags.polarity],
+                       mps_inti_flags_trigger[p->flags.trigger], p->global_irq);
+       }
+               break;
+
+       case ACPI_MADT_LAPIC_NMI:
+       {
+               struct acpi_table_lapic_nmi *p =
+                       (struct acpi_table_lapic_nmi*) header;
+               printk(KERN_INFO PREFIX "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
+                       p->acpi_id,
+                       mps_inti_flags_polarity[p->flags.polarity],
+                       mps_inti_flags_trigger[p->flags.trigger], p->lint);
+       }
+               break;
+
+       case ACPI_MADT_LAPIC_ADDR_OVR:
+       {
+               struct acpi_table_lapic_addr_ovr *p =
+                       (struct acpi_table_lapic_addr_ovr*) header;
+               printk(KERN_INFO PREFIX "LAPIC_ADDR_OVR (address[%p])\n",
+                       (void *) (unsigned long) p->address);
+       }
+               break;
+
+       case ACPI_MADT_IOSAPIC:
+       {
+               struct acpi_table_iosapic *p =
+                       (struct acpi_table_iosapic*) header;
+               printk(KERN_INFO PREFIX "IOSAPIC (id[0x%x] global_irq_base[0x%x] address[%p])\n",
+                       p->id, p->global_irq_base, (void *) (unsigned long) p->address);
+       }
+               break;
+
+       case ACPI_MADT_LSAPIC:
+       {
+               struct acpi_table_lsapic *p =
+                       (struct acpi_table_lsapic*) header;
+               printk(KERN_INFO PREFIX "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
+                       p->acpi_id, p->id, p->eid, p->flags.enabled?"enabled":"disabled");
+       }
+               break;
+
+       case ACPI_MADT_PLAT_INT_SRC:
+       {
+               struct acpi_table_plat_int_src *p =
+                       (struct acpi_table_plat_int_src*) header;
+               printk(KERN_INFO PREFIX "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
+                       mps_inti_flags_polarity[p->flags.polarity],
+                       mps_inti_flags_trigger[p->flags.trigger],
+                       p->type, p->id, p->eid, p->iosapic_vector, p->global_irq);
+       }
+               break;
+
+       default:
+               printk(KERN_WARNING PREFIX "Found unsupported MADT entry (type = 0x%x)\n",
+                       header->type);
+               break;
+       }
+}
+
+
+static int
+acpi_table_compute_checksum (
+       void                    *table_pointer,
+       unsigned long           length)
+{
+       u8                      *p = (u8 *) table_pointer;
+       unsigned long           remains = length;
+       unsigned long           sum = 0;
+
+       if (!p || !length)
+               return -EINVAL;
+
+       while (remains--)
+               sum += *p++;
+
+       return (sum & 0xFF);
+}
+
+/*
+ * acpi_get_table_header_early()
+ * for acpi_blacklisted(), acpi_table_get_sdt()
+ */
+int __init
+acpi_get_table_header_early (
+       enum acpi_table_id      id,
+       struct acpi_table_header **header)
+{
+       unsigned int i;
+       enum acpi_table_id temp_id;
+
+       /* DSDT is different from the rest */
+       if (id == ACPI_DSDT)
+               temp_id = ACPI_FADT;
+       else
+               temp_id = id;
+
+       /* Locate the table. */
+
+       for (i = 0; i < sdt_count; i++) {
+               if (sdt_entry[i].id != temp_id)
+                       continue;
+               *header = (void *)
+                       __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
+               if (!*header) {
+                       printk(KERN_WARNING PREFIX "Unable to map %s\n",
+                              acpi_table_signatures[temp_id]);
+                       return -ENODEV;
+               }
+               break;
+       }
+
+       if (!*header) {
+               printk(KERN_WARNING PREFIX "%s not present\n",
+                      acpi_table_signatures[id]);
+               return -ENODEV;
+       }
+
+       /* Map the DSDT header via the pointer in the FADT */
+       if (id == ACPI_DSDT) {
+               struct fadt_descriptor_rev2 *fadt = (struct fadt_descriptor_rev2 *) *header;
+
+               if (fadt->revision == 3 && fadt->Xdsdt) {
+                       *header = (void *) __acpi_map_table(fadt->Xdsdt,
+                                       sizeof(struct acpi_table_header));
+               } else if (fadt->V1_dsdt) {
+                       *header = (void *) __acpi_map_table(fadt->V1_dsdt,
+                                       sizeof(struct acpi_table_header));
+               } else
+                       *header = 0;
+
+               if (!*header) {
+                       printk(KERN_WARNING PREFIX "Unable to map DSDT\n");
+                       return -ENODEV;
+               }
+       }
+
+       return 0;
+}
+        
+
+int __init
+acpi_table_parse_madt_family (
+       enum acpi_table_id      id,
+       unsigned long           madt_size,
+       int                     entry_id,
+       acpi_madt_entry_handler handler)
+{
+       void                    *madt = NULL;
+       acpi_table_entry_header *entry = NULL;
+       unsigned long           count = 0;
+       unsigned long           madt_end = 0;
+       unsigned int                    i = 0;
+
+       if (!handler)
+               return -EINVAL;
+
+       /* Locate the MADT (if exists). There should only be one. */
+
+       for (i = 0; i < sdt_count; i++) {
+               if (sdt_entry[i].id != id)
+                       continue;
+               madt = (void *)
+                       __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
+               if (!madt) {
+                       printk(KERN_WARNING PREFIX "Unable to map %s\n",
+                              acpi_table_signatures[id]);
+                       return -ENODEV;
+               }
+               break;
+       }
+
+       if (!madt) {
+               printk(KERN_WARNING PREFIX "%s not present\n",
+                      acpi_table_signatures[id]);
+               return -ENODEV;
+       }
+
+       madt_end = (unsigned long) madt + sdt_entry[i].size;
+
+       /* Parse all entries looking for a match. */
+
+       entry = (acpi_table_entry_header *)
+               ((unsigned long) madt + madt_size);
+
+       while (((unsigned long) entry) < madt_end) {
+               if (entry->type == entry_id) {
+                       count++;
+                       handler(entry);
+               }
+               entry = (acpi_table_entry_header *)
+                       ((unsigned long) entry + entry->length);
+       }
+
+       return count;
+}
+
+
+int __init
+acpi_table_parse_madt (
+       enum acpi_madt_entry_id id,
+       acpi_madt_entry_handler handler)
+{
+       return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt),
+                                           id, handler);
+}
+
+
+int __init
+acpi_table_parse (
+       enum acpi_table_id      id,
+       acpi_table_handler      handler)
+{
+       int                     count = 0;
+       unsigned int            i = 0;
+
+       if (!handler)
+               return -EINVAL;
+
+       for (i = 0; i < sdt_count; i++) {
+               if (sdt_entry[i].id != id)
+                       continue;
+               handler(sdt_entry[i].pa, sdt_entry[i].size);
+               count++;
+       }
+
+       return count;
+}
+
+
+static int __init
+acpi_table_get_sdt (
+       struct acpi_table_rsdp  *rsdp)
+{
+       struct acpi_table_header *header = NULL;
+       unsigned int            i, id = 0;
+
+       if (!rsdp)
+               return -EINVAL;
+
+       /* First check XSDT (but only on ACPI 2.0-compatible systems) */
+
+       if ((rsdp->revision >= 2) &&
+               (((struct acpi20_table_rsdp*)rsdp)->xsdt_address)) {
+                       
+               struct acpi_table_xsdt  *mapped_xsdt = NULL;
+
+               sdt_pa = ((struct acpi20_table_rsdp*)rsdp)->xsdt_address;
+
+               /* map in just the header */
+               header = (struct acpi_table_header *)
+                       __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
+
+               if (!header) {
+                       printk(KERN_WARNING PREFIX "Unable to map XSDT header\n");
+                       return -ENODEV;
+               }
+
+               /* remap in the entire table before processing */
+               mapped_xsdt = (struct acpi_table_xsdt *)
+                       __acpi_map_table(sdt_pa, header->length);
+               if (!mapped_xsdt) {
+                       printk(KERN_WARNING PREFIX "Unable to map XSDT\n");
+                       return -ENODEV;
+               }
+               header = &mapped_xsdt->header;
+
+               if (strncmp(header->signature, "XSDT", 4)) {
+                       printk(KERN_WARNING PREFIX "XSDT signature incorrect\n");
+                       return -ENODEV;
+               }
+
+               if (acpi_table_compute_checksum(header, header->length)) {
+                       printk(KERN_WARNING PREFIX "Invalid XSDT checksum\n");
+                       return -ENODEV;
+               }
+
+               sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 3;
+               if (sdt_count > ACPI_MAX_TABLES) {
+                       printk(KERN_WARNING PREFIX "Truncated %lu XSDT entries\n",
+                               (sdt_count - ACPI_MAX_TABLES));
+                       sdt_count = ACPI_MAX_TABLES;
+               }
+
+               for (i = 0; i < sdt_count; i++)
+                       sdt_entry[i].pa = (unsigned long) mapped_xsdt->entry[i];
+       }
+
+       /* Then check RSDT */
+
+       else if (rsdp->rsdt_address) {
+
+               struct acpi_table_rsdt  *mapped_rsdt = NULL;
+
+               sdt_pa = rsdp->rsdt_address;
+
+               /* map in just the header */
+               header = (struct acpi_table_header *)
+                       __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
+               if (!header) {
+                       printk(KERN_WARNING PREFIX "Unable to map RSDT header\n");
+                       return -ENODEV;
+               }
+
+               /* remap in the entire table before processing */
+               mapped_rsdt = (struct acpi_table_rsdt *)
+                       __acpi_map_table(sdt_pa, header->length);
+               if (!mapped_rsdt) {
+                       printk(KERN_WARNING PREFIX "Unable to map RSDT\n");
+                       return -ENODEV;
+               }
+               header = &mapped_rsdt->header;
+
+               if (strncmp(header->signature, "RSDT", 4)) {
+                       printk(KERN_WARNING PREFIX "RSDT signature incorrect\n");
+                       return -ENODEV;
+               }
+
+               if (acpi_table_compute_checksum(header, header->length)) {
+                       printk(KERN_WARNING PREFIX "Invalid RSDT checksum\n");
+                       return -ENODEV;
+               }
+
+               sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 2;
+               if (sdt_count > ACPI_MAX_TABLES) {
+                       printk(KERN_WARNING PREFIX "Truncated %lu RSDT entries\n",
+                               (sdt_count - ACPI_MAX_TABLES));
+                       sdt_count = ACPI_MAX_TABLES;
+               }
+
+               for (i = 0; i < sdt_count; i++)
+                       sdt_entry[i].pa = (unsigned long) mapped_rsdt->entry[i];
+       }
+
+       else {
+               printk(KERN_WARNING PREFIX "No System Description Table (RSDT/XSDT) specified in RSDP\n");
+               return -ENODEV;
+       }
+
+       acpi_table_print(header, sdt_pa);
+
+       for (i = 0; i < sdt_count; i++) {
+
+               /* map in just the header */
+               header = (struct acpi_table_header *)
+                       __acpi_map_table(sdt_entry[i].pa,
+                               sizeof(struct acpi_table_header));
+               if (!header)
+                       continue;
+
+               /* remap in the entire table before processing */
+               header = (struct acpi_table_header *)
+                       __acpi_map_table(sdt_entry[i].pa,
+                               header->length);
+               if (!header)
+                       continue;
+                      
+               acpi_table_print(header, sdt_entry[i].pa);
+
+               if (acpi_table_compute_checksum(header, header->length)) {
+                       printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
+                       continue;
+               }
+
+               sdt_entry[i].size = header->length;
+
+               for (id = 0; id < ACPI_TABLE_COUNT; id++) {
+                       if (!strncmp((char *) &header->signature,
+                               acpi_table_signatures[id],
+                               sizeof(header->signature))) {
+                               sdt_entry[i].id = id;
+                       }
+               }
+       }
+
+       /* 
+        * The DSDT is *not* in the RSDT (why not? no idea.) but we want
+        * to print its info, because this is what people usually blacklist
+        * against. Unfortunately, we don't know the phys_addr, so just
+        * print 0. Maybe no one will notice.
+        */
+       if(!acpi_get_table_header_early(ACPI_DSDT, &header))
+               acpi_table_print(header, 0);
+
+       return 0;
+}
+
+
+int __init
+acpi_table_init (void)
+{
+       struct acpi_table_rsdp  *rsdp = NULL;
+       unsigned long           rsdp_phys = 0;
+       int                     result = 0;
+
+       /* Locate and map the Root System Description Table (RSDP) */
+
+       rsdp_phys = acpi_find_rsdp();
+       if (!rsdp_phys) {
+               printk(KERN_ERR PREFIX "Unable to locate RSDP\n");
+               return -ENODEV;
+       }
+
+       rsdp = (struct acpi_table_rsdp *) __va(rsdp_phys);
+       if (!rsdp) {
+               printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
+               return -ENODEV;
+       }
+
+       printk(KERN_INFO PREFIX "RSDP (v%3.3d %6.6s                                    ) @ 0x%p\n",
+               rsdp->revision, rsdp->oem_id, (void *) rsdp_phys);
+
+       if (rsdp->revision < 2)
+               result = acpi_table_compute_checksum(rsdp, sizeof(struct acpi_table_rsdp));
+       else
+               result = acpi_table_compute_checksum(rsdp, ((struct acpi20_table_rsdp *)rsdp)->length);
+
+       if (result) {
+               printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
+               return -ENODEV;
+       }
+
+       /* Locate and map the System Description table (RSDT/XSDT) */
+
+       if (acpi_table_get_sdt(rsdp))
+               return -ENODEV;
+
+       return 0;
+}
+
diff --git a/xen/include/acpi/acconfig.h b/xen/include/acpi/acconfig.h
new file mode 100644 (file)
index 0000000..8879c2c
--- /dev/null
@@ -0,0 +1,202 @@
+/******************************************************************************
+ *
+ * Name: acconfig.h - Global configuration constants
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _ACCONFIG_H
+#define _ACCONFIG_H
+
+
+/******************************************************************************
+ *
+ * Configuration options
+ *
+ *****************************************************************************/
+
+/*
+ * ACPI_DEBUG_OUTPUT    - This switch enables all the debug facilities of the
+ *                        ACPI subsystem.  This includes the DEBUG_PRINT output
+ *                        statements.  When disabled, all DEBUG_PRINT
+ *                        statements are compiled out.
+ *
+ * ACPI_APPLICATION     - Use this switch if the subsystem is going to be run
+ *                        at the application level.
+ *
+ */
+
+/* Version string */
+
+#define ACPI_CA_VERSION                 0x20040116
+
+/* Maximum objects in the various object caches */
+
+#define ACPI_MAX_STATE_CACHE_DEPTH      64          /* State objects for stacks */
+#define ACPI_MAX_PARSE_CACHE_DEPTH      96          /* Parse tree objects */
+#define ACPI_MAX_EXTPARSE_CACHE_DEPTH   64          /* Parse tree objects */
+#define ACPI_MAX_OBJECT_CACHE_DEPTH     64          /* Interpreter operand objects */
+#define ACPI_MAX_WALK_CACHE_DEPTH       4           /* Objects for parse tree walks */
+
+/*
+ * Should the subystem abort the loading of an ACPI table if the
+ * table checksum is incorrect?
+ */
+#define ACPI_CHECKSUM_ABORT             FALSE
+
+
+/******************************************************************************
+ *
+ * Subsystem Constants
+ *
+ *****************************************************************************/
+
+/* Version of ACPI supported */
+
+#define ACPI_CA_SUPPORT_LEVEL           2
+
+/* String size constants */
+
+#define ACPI_MAX_STRING_LENGTH          512
+#define ACPI_PATHNAME_MAX               256         /* A full namespace pathname */
+
+/* Maximum count for a semaphore object */
+
+#define ACPI_MAX_SEMAPHORE_COUNT        256
+
+/* Max reference count (for debug only) */
+
+#define ACPI_MAX_REFERENCE_COUNT        0x400
+
+/* Size of cached memory mapping for system memory operation region */
+
+#define ACPI_SYSMEM_REGION_WINDOW_SIZE  4096
+
+
+/******************************************************************************
+ *
+ * ACPI Specification constants (Do not change unless the specification changes)
+ *
+ *****************************************************************************/
+
+/* Number of distinct GPE register blocks and register width */
+
+#define ACPI_MAX_GPE_BLOCKS             2
+#define ACPI_GPE_REGISTER_WIDTH         8
+
+/*
+ * Method info (in WALK_STATE), containing local variables and argumetns
+ */
+#define ACPI_METHOD_NUM_LOCALS          8
+#define ACPI_METHOD_MAX_LOCAL           7
+
+#define ACPI_METHOD_NUM_ARGS            7
+#define ACPI_METHOD_MAX_ARG             6
+
+/* Maximum length of resulting string when converting from a buffer */
+
+#define ACPI_MAX_STRING_CONVERSION      200
+
+/* Length of _HID, _UID, and _CID values */
+
+#define ACPI_DEVICE_ID_LENGTH           0x09
+#define ACPI_MAX_CID_LENGTH             48
+
+/*
+ * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
+ */
+#define ACPI_OBJ_NUM_OPERANDS           8
+#define ACPI_OBJ_MAX_OPERAND            7
+
+/* Names within the namespace are 4 bytes long */
+
+#define ACPI_NAME_SIZE                  4
+#define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
+#define ACPI_PATH_SEPARATOR             '.'
+
+/* Constants used in searching for the RSDP in low memory */
+
+#define ACPI_LO_RSDP_WINDOW_BASE        0           /* Physical Address */
+#define ACPI_HI_RSDP_WINDOW_BASE        0xE0000     /* Physical Address */
+#define ACPI_LO_RSDP_WINDOW_SIZE        0x400
+#define ACPI_HI_RSDP_WINDOW_SIZE        0x20000
+#define ACPI_RSDP_SCAN_STEP             16
+
+/* Operation regions */
+
+#define ACPI_NUM_PREDEFINED_REGIONS     8
+#define ACPI_USER_REGION_BEGIN          0x80
+
+/* Maximum space_ids for Operation Regions */
+
+#define ACPI_MAX_ADDRESS_SPACE          255
+
+/* Array sizes.  Used for range checking also */
+
+#define ACPI_NUM_ACCESS_TYPES           6
+#define ACPI_NUM_UPDATE_RULES           3
+#define ACPI_NUM_LOCK_RULES             2
+#define ACPI_NUM_MATCH_OPS              6
+#define ACPI_NUM_OPCODES                256
+#define ACPI_NUM_FIELD_NAMES            2
+
+/* RSDP checksums */
+
+#define ACPI_RSDP_CHECKSUM_LENGTH       20
+#define ACPI_RSDP_XCHECKSUM_LENGTH      36
+
+/* SMBus bidirectional buffer size */
+
+#define ACPI_SMBUS_BUFFER_SIZE          34
+
+
+/******************************************************************************
+ *
+ * ACPI AML Debugger
+ *
+ *****************************************************************************/
+
+#define ACPI_DEBUGGER_MAX_ARGS          8  /* Must be max method args + 1 */
+
+#define ACPI_DEBUGGER_COMMAND_PROMPT    '-'
+#define ACPI_DEBUGGER_EXECUTE_PROMPT    '%'
+
+
+#endif /* _ACCONFIG_H */
+
diff --git a/xen/include/acpi/acdebug.h b/xen/include/acpi/acdebug.h
new file mode 100644 (file)
index 0000000..bb8411e
--- /dev/null
@@ -0,0 +1,469 @@
+/******************************************************************************
+ *
+ * Name: acdebug.h - ACPI/AML debugger
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACDEBUG_H__
+#define __ACDEBUG_H__
+
+
+#define ACPI_DEBUG_BUFFER_SIZE  4196
+
+struct command_info
+{
+       char                            *name;          /* Command Name */
+       u8                              min_args;       /* Minimum arguments required */
+};
+
+
+struct argument_info
+{
+       char                            *name;          /* Argument Name */
+};
+
+
+#define PARAM_LIST(pl)                  pl
+
+#define DBTEST_OUTPUT_LEVEL(lvl)        if (acpi_gbl_db_opt_verbose)
+
+#define VERBOSE_PRINT(fp)               DBTEST_OUTPUT_LEVEL(lvl) {\
+                         acpi_os_printf PARAM_LIST(fp);}
+
+#define EX_NO_SINGLE_STEP               1
+#define EX_SINGLE_STEP                  2
+
+
+/* Prototypes */
+
+
+/*
+ * dbxface - external debugger interfaces
+ */
+
+acpi_status
+acpi_db_initialize (
+       void);
+
+void
+acpi_db_terminate (
+       void);
+
+acpi_status
+acpi_db_single_step (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op,
+       u32                             op_type);
+
+acpi_status
+acpi_db_start_command (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+void
+acpi_db_method_end (
+       struct acpi_walk_state          *walk_state);
+
+
+/*
+ * dbcmds - debug commands and output routines
+ */
+
+void
+acpi_db_display_table_info (
+       char                            *table_arg);
+
+void
+acpi_db_unload_acpi_table (
+       char                            *table_arg,
+       char                            *instance_arg);
+
+void
+acpi_db_set_method_breakpoint (
+       char                            *location,
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+void
+acpi_db_set_method_call_breakpoint (
+       union acpi_parse_object         *op);
+
+void
+acpi_db_disassemble_aml (
+       char                            *statements,
+       union acpi_parse_object         *op);
+
+void
+acpi_db_dump_namespace (
+       char                            *start_arg,
+       char                            *depth_arg);
+
+void
+acpi_db_dump_namespace_by_owner (
+       char                            *owner_arg,
+       char                            *depth_arg);
+
+void
+acpi_db_send_notify (
+       char                            *name,
+       u32                             value);
+
+void
+acpi_db_set_method_data (
+       char                            *type_arg,
+       char                            *index_arg,
+       char                            *value_arg);
+
+acpi_status
+acpi_db_display_objects (
+       char                            *obj_type_arg,
+       char                            *display_count_arg);
+
+acpi_status
+acpi_db_find_name_in_namespace (
+       char                            *name_arg);
+
+void
+acpi_db_set_scope (
+       char                            *name);
+
+void
+acpi_db_find_references (
+       char                            *object_arg);
+
+void
+acpi_db_display_locks (void);
+
+
+void
+acpi_db_display_resources (
+       char                            *object_arg);
+
+void
+acpi_db_display_gpes (void);
+
+void
+acpi_db_check_integrity (
+       void);
+
+acpi_status
+acpi_db_integrity_walk (
+       acpi_handle                     obj_handle,
+       u32                             nesting_level,
+       void                            *context,
+       void                            **return_value);
+
+acpi_status
+acpi_db_walk_and_match_name (
+       acpi_handle                     obj_handle,
+       u32                             nesting_level,
+       void                            *context,
+       void                            **return_value);
+
+acpi_status
+acpi_db_walk_for_references (
+       acpi_handle                     obj_handle,
+       u32                             nesting_level,
+       void                            *context,
+       void                            **return_value);
+
+acpi_status
+acpi_db_walk_for_specific_objects (
+       acpi_handle                     obj_handle,
+       u32                             nesting_level,
+       void                            *context,
+       void                            **return_value);
+
+void
+acpi_db_generate_gpe (
+       char                            *gpe_arg,
+       char                            *block_arg);
+
+/*
+ * dbdisply - debug display commands
+ */
+
+void
+acpi_db_display_method_info (
+       union acpi_parse_object         *op);
+
+void
+acpi_db_decode_and_display_object (
+       char                            *target,
+       char                            *output_type);
+
+void
+acpi_db_display_result_object (
+       union acpi_operand_object       *obj_desc,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_db_display_all_methods (
+       char                            *display_count_arg);
+
+void
+acpi_db_display_arguments (
+       void);
+
+void
+acpi_db_display_locals (
+       void);
+
+void
+acpi_db_display_results (
+       void);
+
+void
+acpi_db_display_calling_tree (
+       void);
+
+void
+acpi_db_display_object_type (
+       char                            *object_arg);
+
+void
+acpi_db_display_argument_object (
+       union acpi_operand_object       *obj_desc,
+       struct acpi_walk_state          *walk_state);
+
+void
+acpi_db_dump_parser_descriptor (
+       union acpi_parse_object         *op);
+
+void *
+acpi_db_get_pointer (
+       void                            *target);
+
+
+/*
+ * dbexec - debugger control method execution
+ */
+
+void
+acpi_db_execute (
+       char                            *name,
+       char                            **args,
+       u32                             flags);
+
+void
+acpi_db_create_execution_threads (
+       char                            *num_threads_arg,
+       char                            *num_loops_arg,
+       char                            *method_name_arg);
+
+acpi_status
+acpi_db_execute_method (
+       struct acpi_db_method_info      *info,
+       struct acpi_buffer              *return_obj);
+
+void
+acpi_db_execute_setup (
+       struct acpi_db_method_info      *info);
+
+u32
+acpi_db_get_outstanding_allocations (
+       void);
+
+void ACPI_SYSTEM_XFACE
+acpi_db_method_thread (
+       void                            *context);
+
+acpi_status
+acpi_db_execution_walk (
+       acpi_handle                     obj_handle,
+       u32                             nesting_level,
+       void                            *context,
+       void                            **return_value);
+
+
+/*
+ * dbfileio - Debugger file I/O commands
+ */
+
+acpi_object_type
+acpi_db_match_argument (
+       char                            *user_argument,
+       struct argument_info            *arguments);
+
+acpi_status
+ae_local_load_table (
+       struct acpi_table_header        *table_ptr);
+
+void
+acpi_db_close_debug_file (
+       void);
+
+void
+acpi_db_open_debug_file (
+       char                            *name);
+
+acpi_status
+acpi_db_load_acpi_table (
+       char                            *filename);
+
+acpi_status
+acpi_db_get_table_from_file (
+       char                            *filename,
+       struct acpi_table_header        **table);
+
+acpi_status
+acpi_db_read_table_from_file (
+       char                            *filename,
+       struct acpi_table_header        **table);
+
+/*
+ * dbhistry - debugger HISTORY command
+ */
+
+void
+acpi_db_add_to_history (
+       char                            *command_line);
+
+void
+acpi_db_display_history (void);
+
+char *
+acpi_db_get_from_history (
+       char                            *command_num_arg);
+
+
+/*
+ * dbinput - user front-end to the AML debugger
+ */
+
+acpi_status
+acpi_db_command_dispatch (
+       char                            *input_buffer,
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+void ACPI_SYSTEM_XFACE
+acpi_db_execute_thread (
+       void                            *context);
+
+acpi_status
+acpi_db_user_commands (
+       char                            prompt,
+       union acpi_parse_object         *op);
+
+void
+acpi_db_display_help (
+       char                            *help_type);
+
+char *
+acpi_db_get_next_token (
+       char                            *string,
+       char                            **next);
+
+u32
+acpi_db_get_line (
+       char                            *input_buffer);
+
+u32
+acpi_db_match_command (
+       char                            *user_command);
+
+void
+acpi_db_single_thread (
+       void);
+
+
+/*
+ * dbstats - Generation and display of ACPI table statistics
+ */
+
+void
+acpi_db_generate_statistics (
+       union acpi_parse_object         *root,
+       u8                              is_method);
+
+
+acpi_status
+acpi_db_display_statistics (
+       char                            *type_arg);
+
+acpi_status
+acpi_db_classify_one_object (
+       acpi_handle                     obj_handle,
+       u32                             nesting_level,
+       void                            *context,
+       void                            **return_value);
+
+void
+acpi_db_count_namespace_objects (
+       void);
+
+void
+acpi_db_enumerate_object (
+       union acpi_operand_object       *obj_desc);
+
+
+/*
+ * dbutils - AML debugger utilities
+ */
+
+void
+acpi_db_set_output_destination (
+       u32                             where);
+
+void
+acpi_db_dump_buffer (
+       u32                             address);
+
+void
+acpi_db_dump_object (
+       union acpi_object               *obj_desc,
+       u32                             level);
+
+void
+acpi_db_prep_namestring (
+       char                            *name);
+
+
+acpi_status
+acpi_db_second_pass_parse (
+       union acpi_parse_object         *root);
+
+struct acpi_namespace_node *
+acpi_db_local_ns_lookup (
+       char                            *name);
+
+
+#endif  /* __ACDEBUG_H__ */
diff --git a/xen/include/acpi/acdisasm.h b/xen/include/acpi/acdisasm.h
new file mode 100644 (file)
index 0000000..220bd1b
--- /dev/null
@@ -0,0 +1,402 @@
+/******************************************************************************
+ *
+ * Name: acdisasm.h - AML disassembler
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACDISASM_H__
+#define __ACDISASM_H__
+
+#include "amlresrc.h"
+
+
+#define BLOCK_NONE              0
+#define BLOCK_PAREN             1
+#define BLOCK_BRACE             2
+#define BLOCK_COMMA_LIST        4
+
+extern const char                       *acpi_gbl_io_decode[2];
+extern const char                       *acpi_gbl_word_decode[4];
+extern const char                       *acpi_gbl_consume_decode[2];
+extern const char                       *acpi_gbl_min_decode[2];
+extern const char                       *acpi_gbl_max_decode[2];
+extern const char                       *acpi_gbl_DECdecode[2];
+extern const char                       *acpi_gbl_RNGdecode[4];
+extern const char                       *acpi_gbl_MEMdecode[4];
+extern const char                       *acpi_gbl_RWdecode[2];
+extern const char                       *acpi_gbl_irq_decode[2];
+extern const char                       *acpi_gbl_HEdecode[2];
+extern const char                       *acpi_gbl_LLdecode[2];
+extern const char                       *acpi_gbl_SHRdecode[2];
+extern const char                       *acpi_gbl_TYPdecode[4];
+extern const char                       *acpi_gbl_BMdecode[2];
+extern const char                       *acpi_gbl_SIZdecode[4];
+extern const char                       *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
+extern const char                       *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
+extern const char                       *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
+extern const char                       *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
+
+
+struct acpi_op_walk_info
+{
+       u32                             level;
+       u32                             bit_offset;
+};
+
+typedef
+acpi_status (*asl_walk_callback) (
+       union acpi_parse_object             *op,
+       u32                                 level,
+       void                                *context);
+
+
+/*
+ * dmwalk
+ */
+
+void
+acpi_dm_walk_parse_tree (
+       union acpi_parse_object         *op,
+       asl_walk_callback               descending_callback,
+       asl_walk_callback               ascending_callback,
+       void                            *context);
+
+acpi_status
+acpi_dm_descending_op (
+       union acpi_parse_object         *op,
+       u32                             level,
+       void                            *context);
+
+acpi_status
+acpi_dm_ascending_op (
+       union acpi_parse_object         *op,
+       u32                             level,
+       void                            *context);
+
+
+/*
+ * dmopcode
+ */
+
+void
+acpi_dm_validate_name (
+       char                            *name,
+       union acpi_parse_object         *op);
+
+u32
+acpi_dm_dump_name (
+       char                            *name);
+
+void
+acpi_dm_unicode (
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_disassemble (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *origin,
+       u32                             num_opcodes);
+
+void
+acpi_dm_namestring (
+       char                            *name);
+
+void
+acpi_dm_display_path (
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_disassemble_one_op (
+       struct acpi_walk_state          *walk_state,
+       struct acpi_op_walk_info        *info,
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_decode_internal_object (
+       union acpi_operand_object       *obj_desc);
+
+u32
+acpi_dm_block_type (
+       union acpi_parse_object         *op);
+
+u32
+acpi_dm_list_type (
+       union acpi_parse_object         *op);
+
+acpi_status
+acpi_ps_display_object_pathname (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_method_flags (
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_field_flags (
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_address_space (
+       u8                              space_id);
+
+void
+acpi_dm_region_flags (
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_match_op (
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_match_keyword (
+       union acpi_parse_object         *op);
+
+u8
+acpi_dm_comma_if_list_member (
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_comma_if_field_member (
+       union acpi_parse_object         *op);
+
+
+/*
+ * dmobject
+ */
+
+void
+acpi_dm_decode_node (
+       struct acpi_namespace_node      *node);
+
+void
+acpi_dm_display_internal_object (
+       union acpi_operand_object       *obj_desc,
+       struct acpi_walk_state          *walk_state);
+
+void
+acpi_dm_display_arguments (
+       struct acpi_walk_state          *walk_state);
+
+void
+acpi_dm_display_locals (
+       struct acpi_walk_state          *walk_state);
+
+void
+acpi_dm_dump_method_info (
+       acpi_status                     status,
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+
+/*
+ * dmbuffer
+ */
+
+void
+acpi_is_eisa_id (
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_eisa_id (
+       u32                             encoded_id);
+
+u8
+acpi_dm_is_unicode_buffer (
+       union acpi_parse_object         *op);
+
+u8
+acpi_dm_is_string_buffer (
+       union acpi_parse_object         *op);
+
+
+/*
+ * dmresrc
+ */
+
+void
+acpi_dm_disasm_byte_list (
+       u32                             level,
+       u8                              *byte_data,
+       u32                             byte_count);
+
+void
+acpi_dm_byte_list (
+       struct acpi_op_walk_info        *info,
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_resource_descriptor (
+       struct acpi_op_walk_info        *info,
+       u8                              *byte_data,
+       u32                             byte_count);
+
+u8
+acpi_dm_is_resource_descriptor (
+       union acpi_parse_object         *op);
+
+void
+acpi_dm_indent (
+       u32                             level);
+
+void
+acpi_dm_bit_list (
+       u16                             mask);
+
+void
+acpi_dm_decode_attribute (
+       u8                              attribute);
+
+/*
+ * dmresrcl
+ */
+
+void
+acpi_dm_io_flags (
+               u8                          flags);
+
+void
+acpi_dm_memory_flags (
+       u8                              flags,
+       u8                              specific_flags);
+
+void
+acpi_dm_word_descriptor (
+       struct asl_word_address_desc    *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_dword_descriptor (
+       struct asl_dword_address_desc   *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_qword_descriptor (
+       struct asl_qword_address_desc   *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_memory24_descriptor (
+       struct asl_memory_24_desc       *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_memory32_descriptor (
+       struct asl_memory_32_desc       *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_fixed_mem32_descriptor (
+       struct asl_fixed_memory_32_desc *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_generic_register_descriptor (
+       struct asl_general_register_desc *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_interrupt_descriptor (
+       struct asl_extended_xrupt_desc *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_vendor_large_descriptor (
+       struct asl_large_vendor_desc    *resource,
+       u32                             length,
+       u32                             level);
+
+
+/*
+ * dmresrcs
+ */
+
+void
+acpi_dm_irq_descriptor (
+       struct asl_irq_format_desc      *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_dma_descriptor (
+       struct asl_dma_format_desc      *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_io_descriptor (
+       struct asl_io_port_desc         *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_fixed_io_descriptor (
+       struct asl_fixed_io_port_desc   *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_start_dependent_descriptor (
+       struct asl_start_dependent_desc *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_end_dependent_descriptor (
+       struct asl_start_dependent_desc *resource,
+       u32                             length,
+       u32                             level);
+
+void
+acpi_dm_vendor_small_descriptor (
+       struct asl_small_vendor_desc    *resource,
+       u32                             length,
+       u32                             level);
+
+
+#endif  /* __ACDISASM_H__ */
diff --git a/xen/include/acpi/acdispat.h b/xen/include/acpi/acdispat.h
new file mode 100644 (file)
index 0000000..2a09e92
--- /dev/null
@@ -0,0 +1,513 @@
+/******************************************************************************
+ *
+ * Name: acdispat.h - dispatcher (parser to interpreter interface)
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+#ifndef _ACDISPAT_H_
+#define _ACDISPAT_H_
+
+
+#define NAMEOF_LOCAL_NTE    "__L0"
+#define NAMEOF_ARG_NTE      "__A0"
+
+
+/* Common interfaces */
+
+acpi_status
+acpi_ds_obj_stack_push (
+       void                            *object,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_obj_stack_pop (
+       u32                             pop_count,
+       struct acpi_walk_state          *walk_state);
+
+void *
+acpi_ds_obj_stack_get_value (
+       u32                             index,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_obj_stack_pop_object (
+       union acpi_operand_object       **object,
+       struct acpi_walk_state          *walk_state);
+
+
+/* dsopcode - support for late evaluation */
+
+acpi_status
+acpi_ds_execute_arguments (
+       struct acpi_namespace_node      *node,
+       struct acpi_namespace_node      *scope_node,
+       u32                             aml_length,
+       u8                              *aml_start);
+
+acpi_status
+acpi_ds_get_buffer_field_arguments (
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ds_get_region_arguments (
+       union acpi_operand_object       *rgn_desc);
+
+acpi_status
+acpi_ds_get_buffer_arguments (
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ds_get_package_arguments (
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ds_init_buffer_field (
+       u16                             aml_opcode,
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       *buffer_desc,
+       union acpi_operand_object       *offset_desc,
+       union acpi_operand_object       *length_desc,
+       union acpi_operand_object       *result_desc);
+
+acpi_status
+acpi_ds_eval_buffer_field_operands (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+acpi_status
+acpi_ds_eval_region_operands (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+acpi_status
+acpi_ds_eval_data_object_operands (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op,
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ds_initialize_region (
+       acpi_handle                     obj_handle);
+
+
+/* dsctrl - Parser/Interpreter interface, control stack routines */
+
+
+acpi_status
+acpi_ds_exec_begin_control_op (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+acpi_status
+acpi_ds_exec_end_control_op (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+
+/* dsexec - Parser/Interpreter interface, method execution callbacks */
+
+
+acpi_status
+acpi_ds_get_predicate_value (
+       struct acpi_walk_state          *walk_state,
+       union acpi_operand_object       *result_obj);
+
+acpi_status
+acpi_ds_exec_begin_op (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         **out_op);
+
+acpi_status
+acpi_ds_exec_end_op (
+       struct acpi_walk_state          *state);
+
+
+/* dsfield - Parser/Interpreter interface for AML fields */
+
+acpi_status
+acpi_ds_get_field_names (
+       struct acpi_create_field_info   *info,
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *arg);
+
+acpi_status
+acpi_ds_create_field (
+       union acpi_parse_object         *op,
+       struct acpi_namespace_node      *region_node,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_create_bank_field (
+       union acpi_parse_object         *op,
+       struct acpi_namespace_node      *region_node,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_create_index_field (
+       union acpi_parse_object         *op,
+       struct acpi_namespace_node      *region_node,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_create_buffer_field (
+       union acpi_parse_object         *op,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_init_field_objects (
+       union acpi_parse_object         *op,
+       struct acpi_walk_state          *walk_state);
+
+
+/* dsload - Parser/Interpreter interface, namespace load callbacks */
+
+acpi_status
+acpi_ds_load1_begin_op (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         **out_op);
+
+acpi_status
+acpi_ds_load1_end_op (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_load2_begin_op (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         **out_op);
+
+acpi_status
+acpi_ds_load2_end_op (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_init_callbacks (
+       struct acpi_walk_state          *walk_state,
+       u32                             pass_number);
+
+
+/* dsmthdat - method data (locals/args) */
+
+
+acpi_status
+acpi_ds_store_object_to_local (
+       u16                             opcode,
+       u32                             index,
+       union acpi_operand_object       *src_desc,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_method_data_get_entry (
+       u16                             opcode,
+       u32                             index,
+       struct acpi_walk_state          *walk_state,
+       union acpi_operand_object       ***node);
+
+void
+acpi_ds_method_data_delete_all (
+       struct acpi_walk_state          *walk_state);
+
+u8
+acpi_ds_is_method_value (
+       union acpi_operand_object       *obj_desc);
+
+acpi_object_type
+acpi_ds_method_data_get_type (
+       u16                             opcode,
+       u32                             index,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_method_data_get_value (
+       u16                             opcode,
+       u32                             index,
+       struct acpi_walk_state          *walk_state,
+       union acpi_operand_object       **dest_desc);
+
+void
+acpi_ds_method_data_delete_value (
+       u16                             opcode,
+       u32                             index,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_method_data_init_args (
+       union acpi_operand_object       **params,
+       u32                             max_param_count,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_method_data_get_node (
+       u16                             opcode,
+       u32                             index,
+       struct acpi_walk_state          *walk_state,
+       struct acpi_namespace_node      **node);
+
+void
+acpi_ds_method_data_init (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_method_data_set_value (
+       u16                             opcode,
+       u32                             index,
+       union acpi_operand_object       *object,
+       struct acpi_walk_state          *walk_state);
+
+
+/* dsmethod - Parser/Interpreter interface - control method parsing */
+
+acpi_status
+acpi_ds_parse_method (
+       acpi_handle                     obj_handle);
+
+acpi_status
+acpi_ds_call_control_method (
+       struct acpi_thread_state        *thread,
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+acpi_status
+acpi_ds_restart_control_method (
+       struct acpi_walk_state          *walk_state,
+       union acpi_operand_object       *return_desc);
+
+acpi_status
+acpi_ds_terminate_control_method (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_begin_method_execution (
+       struct acpi_namespace_node      *method_node,
+       union acpi_operand_object       *obj_desc,
+       struct acpi_namespace_node      *calling_method_node);
+
+
+/* dsobj - Parser/Interpreter interface - object initialization and conversion */
+
+acpi_status
+acpi_ds_init_one_object (
+       acpi_handle                     obj_handle,
+       u32                             level,
+       void                            *context,
+       void                            **return_value);
+
+acpi_status
+acpi_ds_initialize_objects (
+       struct acpi_table_desc          *table_desc,
+       struct acpi_namespace_node      *start_node);
+
+acpi_status
+acpi_ds_build_internal_buffer_obj (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op,
+       u32                             buffer_length,
+       union acpi_operand_object       **obj_desc_ptr);
+
+acpi_status
+acpi_ds_build_internal_package_obj (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op,
+       u32                             package_length,
+       union acpi_operand_object       **obj_desc);
+
+acpi_status
+acpi_ds_build_internal_object (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op,
+       union acpi_operand_object       **obj_desc_ptr);
+
+acpi_status
+acpi_ds_init_object_from_op (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op,
+       u16                             opcode,
+       union acpi_operand_object       **obj_desc);
+
+acpi_status
+acpi_ds_create_node (
+       struct acpi_walk_state          *walk_state,
+       struct acpi_namespace_node      *node,
+       union acpi_parse_object         *op);
+
+
+/* dsutils - Parser/Interpreter interface utility routines */
+
+u8
+acpi_ds_is_result_used (
+       union acpi_parse_object         *op,
+       struct acpi_walk_state          *walk_state);
+
+void
+acpi_ds_delete_result_if_not_used (
+       union acpi_parse_object         *op,
+       union acpi_operand_object       *result_obj,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_create_operand (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *arg,
+       u32                             args_remaining);
+
+acpi_status
+acpi_ds_create_operands (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *first_arg);
+
+acpi_status
+acpi_ds_resolve_operands (
+       struct acpi_walk_state          *walk_state);
+
+void
+acpi_ds_clear_operands (
+       struct acpi_walk_state          *walk_state);
+
+
+/*
+ * dswscope - Scope Stack manipulation
+ */
+
+acpi_status
+acpi_ds_scope_stack_push (
+       struct acpi_namespace_node      *node,
+       acpi_object_type                type,
+       struct acpi_walk_state          *walk_state);
+
+
+acpi_status
+acpi_ds_scope_stack_pop (
+       struct acpi_walk_state          *walk_state);
+
+void
+acpi_ds_scope_stack_clear (
+       struct acpi_walk_state          *walk_state);
+
+
+/* dswstate - parser WALK_STATE management routines */
+
+struct acpi_walk_state *
+acpi_ds_create_walk_state (
+       acpi_owner_id                   owner_id,
+       union acpi_parse_object         *origin,
+       union acpi_operand_object       *mth_desc,
+       struct acpi_thread_state        *thread);
+
+acpi_status
+acpi_ds_init_aml_walk (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op,
+       struct acpi_namespace_node      *method_node,
+       u8                              *aml_start,
+       u32                             aml_length,
+       union acpi_operand_object       **params,
+       union acpi_operand_object       **return_obj_desc,
+       u32                             pass_number);
+
+acpi_status
+acpi_ds_obj_stack_delete_all (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_obj_stack_pop_and_delete (
+       u32                             pop_count,
+       struct acpi_walk_state          *walk_state);
+
+void
+acpi_ds_delete_walk_state (
+       struct acpi_walk_state          *walk_state);
+
+struct acpi_walk_state *
+acpi_ds_pop_walk_state (
+       struct acpi_thread_state        *thread);
+
+void
+acpi_ds_push_walk_state (
+       struct acpi_walk_state          *walk_state,
+       struct acpi_thread_state        *thread);
+
+acpi_status
+acpi_ds_result_stack_pop (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_result_stack_push (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_result_stack_clear (
+       struct acpi_walk_state          *walk_state);
+
+struct acpi_walk_state *
+acpi_ds_get_current_walk_state (
+       struct acpi_thread_state        *thread);
+
+void
+acpi_ds_delete_walk_state_cache (
+       void);
+
+acpi_status
+acpi_ds_result_insert (
+       void                            *object,
+       u32                             index,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_result_remove (
+       union acpi_operand_object       **object,
+       u32                             index,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_result_pop (
+       union acpi_operand_object       **object,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_result_push (
+       union acpi_operand_object       *object,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ds_result_pop_from_bottom (
+       union acpi_operand_object       **object,
+       struct acpi_walk_state          *walk_state);
+
+#endif /* _ACDISPAT_H_ */
diff --git a/xen/include/acpi/acevents.h b/xen/include/acpi/acevents.h
new file mode 100644 (file)
index 0000000..4ab99b2
--- /dev/null
@@ -0,0 +1,274 @@
+/******************************************************************************
+ *
+ * Name: acevents.h - Event subcomponent prototypes and defines
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACEVENTS_H__
+#define __ACEVENTS_H__
+
+
+acpi_status
+acpi_ev_initialize (
+       void);
+
+acpi_status
+acpi_ev_handler_initialize (
+       void);
+
+
+/*
+ * Evfixed - Fixed event handling
+ */
+
+acpi_status
+acpi_ev_fixed_event_initialize (
+       void);
+
+u32
+acpi_ev_fixed_event_detect (
+       void);
+
+u32
+acpi_ev_fixed_event_dispatch (
+       u32                             event);
+
+
+/*
+ * Evmisc
+ */
+
+u8
+acpi_ev_is_notify_object (
+       struct acpi_namespace_node      *node);
+
+acpi_status
+acpi_ev_acquire_global_lock(
+       u16                             timeout);
+
+acpi_status
+acpi_ev_release_global_lock(
+       void);
+
+acpi_status
+acpi_ev_init_global_lock_handler (
+       void);
+
+u32
+acpi_ev_get_gpe_number_index (
+       u32                             gpe_number);
+
+acpi_status
+acpi_ev_queue_notify_request (
+       struct acpi_namespace_node      *node,
+       u32                             notify_value);
+
+void ACPI_SYSTEM_XFACE
+acpi_ev_notify_dispatch (
+       void                            *context);
+
+
+/*
+ * Evgpe - GPE handling and dispatch
+ */
+
+acpi_status
+acpi_ev_walk_gpe_list (
+       ACPI_GPE_CALLBACK       gpe_walk_callback);
+
+u8
+acpi_ev_valid_gpe_event (
+       struct acpi_gpe_event_info      *gpe_event_info);
+
+struct acpi_gpe_event_info *
+acpi_ev_get_gpe_event_info (
+       acpi_handle                     gpe_device,
+       u32                             gpe_number);
+
+acpi_status
+acpi_ev_gpe_initialize (
+       void);
+
+acpi_status
+acpi_ev_create_gpe_block (
+       struct acpi_namespace_node      *gpe_device,
+       struct acpi_generic_address     *gpe_block_address,
+       u32                             register_count,
+       u8                              gpe_block_base_number,
+       u32                             interrupt_level,
+       struct acpi_gpe_block_info      **return_gpe_block);
+
+acpi_status
+acpi_ev_delete_gpe_block (
+       struct acpi_gpe_block_info      *gpe_block);
+
+u32
+acpi_ev_gpe_dispatch (
+       struct acpi_gpe_event_info      *gpe_event_info,
+       u32                             gpe_number);
+
+u32
+acpi_ev_gpe_detect (
+       struct acpi_gpe_xrupt_info      *gpe_xrupt_list);
+
+/*
+ * Evregion - Address Space handling
+ */
+
+acpi_status
+acpi_ev_init_address_spaces (
+       void);
+
+acpi_status
+acpi_ev_address_space_dispatch (
+       union acpi_operand_object      *region_obj,
+       u32                             function,
+       acpi_physical_address           address,
+       u32                             bit_width,
+       void                            *value);
+
+acpi_status
+acpi_ev_install_handler (
+       acpi_handle                     obj_handle,
+       u32                             level,
+       void                            *context,
+       void                            **return_value);
+
+acpi_status
+acpi_ev_attach_region (
+       union acpi_operand_object       *handler_obj,
+       union acpi_operand_object       *region_obj,
+       u8                              acpi_ns_is_locked);
+
+void
+acpi_ev_detach_region (
+       union acpi_operand_object      *region_obj,
+       u8                              acpi_ns_is_locked);
+
+acpi_status
+acpi_ev_execute_reg_method (
+       union acpi_operand_object      *region_obj,
+       u32                             function);
+
+acpi_status
+acpi_ev_reg_run (
+       acpi_handle                     obj_handle,
+       u32                             level,
+       void                            *context,
+       void                            **return_value);
+
+/*
+ * Evregini - Region initialization and setup
+ */
+
+acpi_status
+acpi_ev_system_memory_region_setup (
+       acpi_handle                     handle,
+       u32                             function,
+       void                            *handler_context,
+       void                            **region_context);
+
+acpi_status
+acpi_ev_io_space_region_setup (
+       acpi_handle                     handle,
+       u32                             function,
+       void                            *handler_context,
+       void                            **region_context);
+
+acpi_status
+acpi_ev_pci_config_region_setup (
+       acpi_handle                     handle,
+       u32                             function,
+       void                            *handler_context,
+       void                            **region_context);
+
+acpi_status
+acpi_ev_cmos_region_setup (
+       acpi_handle                     handle,
+       u32                             function,
+       void                            *handler_context,
+       void                            **region_context);
+
+acpi_status
+acpi_ev_pci_bar_region_setup (
+       acpi_handle                     handle,
+       u32                             function,
+       void                            *handler_context,
+       void                            **region_context);
+
+acpi_status
+acpi_ev_default_region_setup (
+       acpi_handle                     handle,
+       u32                             function,
+       void                            *handler_context,
+       void                            **region_context);
+
+acpi_status
+acpi_ev_initialize_region (
+       union acpi_operand_object       *region_obj,
+       u8                              acpi_ns_locked);
+
+
+/*
+ * Evsci - SCI (System Control Interrupt) handling/dispatch
+ */
+
+u32 ACPI_SYSTEM_XFACE
+acpi_ev_gpe_xrupt_handler (
+       void                            *context);
+
+u32
+acpi_ev_install_sci_handler (
+       void);
+
+acpi_status
+acpi_ev_remove_sci_handler (
+       void);
+
+u32
+acpi_ev_initialize_sCI (
+       u32                             program_sCI);
+
+void
+acpi_ev_terminate (
+       void);
+
+
+#endif  /* __ACEVENTS_H__  */
diff --git a/xen/include/acpi/acexcep.h b/xen/include/acpi/acexcep.h
new file mode 100644 (file)
index 0000000..9441f5c
--- /dev/null
@@ -0,0 +1,306 @@
+/******************************************************************************
+ *
+ * Name: acexcep.h - Exception codes returned by the ACPI subsystem
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACEXCEP_H__
+#define __ACEXCEP_H__
+
+
+/*
+ * Exceptions returned by external ACPI interfaces
+ */
+
+#define AE_CODE_ENVIRONMENTAL           0x0000
+#define AE_CODE_PROGRAMMER              0x1000
+#define AE_CODE_ACPI_TABLES             0x2000
+#define AE_CODE_AML                     0x3000
+#define AE_CODE_CONTROL                 0x4000
+#define AE_CODE_MASK                    0xF000
+
+
+#define ACPI_SUCCESS(a)                 (!(a))
+#define ACPI_FAILURE(a)                 (a)
+
+
+#define AE_OK                           (acpi_status) 0x0000
+
+/*
+ * Environmental exceptions
+ */
+#define AE_ERROR                        (acpi_status) (0x0001 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_ACPI_TABLES               (acpi_status) (0x0002 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_NAMESPACE                 (acpi_status) (0x0003 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_MEMORY                    (acpi_status) (0x0004 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_FOUND                    (acpi_status) (0x0005 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_EXIST                    (acpi_status) (0x0006 | AE_CODE_ENVIRONMENTAL)
+#define AE_ALREADY_EXISTS               (acpi_status) (0x0007 | AE_CODE_ENVIRONMENTAL)
+#define AE_TYPE                         (acpi_status) (0x0008 | AE_CODE_ENVIRONMENTAL)
+#define AE_NULL_OBJECT                  (acpi_status) (0x0009 | AE_CODE_ENVIRONMENTAL)
+#define AE_NULL_ENTRY                   (acpi_status) (0x000A | AE_CODE_ENVIRONMENTAL)
+#define AE_BUFFER_OVERFLOW              (acpi_status) (0x000B | AE_CODE_ENVIRONMENTAL)
+#define AE_STACK_OVERFLOW               (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL)
+#define AE_STACK_UNDERFLOW              (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_IMPLEMENTED              (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL)
+#define AE_VERSION_MISMATCH             (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL)
+#define AE_SUPPORT                      (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL)
+#define AE_SHARE                        (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL)
+#define AE_LIMIT                        (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL)
+#define AE_TIME                         (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL)
+#define AE_UNKNOWN_STATUS               (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL)
+#define AE_ACQUIRE_DEADLOCK             (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL)
+#define AE_RELEASE_DEADLOCK             (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_ACQUIRED                 (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
+#define AE_ALREADY_ACQUIRED             (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_HARDWARE_RESPONSE         (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_GLOBAL_LOCK               (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
+#define AE_LOGICAL_ADDRESS              (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
+#define AE_ABORT_METHOD                 (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
+#define AE_SAME_HANDLER                 (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL)
+
+#define AE_CODE_ENV_MAX                 0x001D
+
+/*
+ * Programmer exceptions
+ */
+#define AE_BAD_PARAMETER                (acpi_status) (0x0001 | AE_CODE_PROGRAMMER)
+#define AE_BAD_CHARACTER                (acpi_status) (0x0002 | AE_CODE_PROGRAMMER)
+#define AE_BAD_PATHNAME                 (acpi_status) (0x0003 | AE_CODE_PROGRAMMER)
+#define AE_BAD_DATA                     (acpi_status) (0x0004 | AE_CODE_PROGRAMMER)
+#define AE_BAD_ADDRESS                  (acpi_status) (0x0005 | AE_CODE_PROGRAMMER)
+#define AE_ALIGNMENT                    (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
+#define AE_BAD_HEX_CONSTANT             (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)
+#define AE_BAD_OCTAL_CONSTANT           (acpi_status) (0x0008 | AE_CODE_PROGRAMMER)
+#define AE_BAD_DECIMAL_CONSTANT         (acpi_status) (0x0009 | AE_CODE_PROGRAMMER)
+
+#define AE_CODE_PGM_MAX                 0x0009
+
+
+/*
+ * Acpi table exceptions
+ */
+#define AE_BAD_SIGNATURE                (acpi_status) (0x0001 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_HEADER                   (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_CHECKSUM                 (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES)
+#define AE_BAD_VALUE                    (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES)
+#define AE_TABLE_NOT_SUPPORTED          (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES)
+#define AE_INVALID_TABLE_LENGTH         (acpi_status) (0x0006 | AE_CODE_ACPI_TABLES)
+
+#define AE_CODE_TBL_MAX                 0x0006
+
+
+/*
+ * AML exceptions.  These are caused by problems with
+ * the actual AML byte stream
+ */
+#define AE_AML_ERROR                    (acpi_status) (0x0001 | AE_CODE_AML)
+#define AE_AML_PARSE                    (acpi_status) (0x0002 | AE_CODE_AML)
+#define AE_AML_BAD_OPCODE               (acpi_status) (0x0003 | AE_CODE_AML)
+#define AE_AML_NO_OPERAND               (acpi_status) (0x0004 | AE_CODE_AML)
+#define AE_AML_OPERAND_TYPE             (acpi_status) (0x0005 | AE_CODE_AML)
+#define AE_AML_OPERAND_VALUE            (acpi_status) (0x0006 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_LOCAL      (acpi_status) (0x0007 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_ARG        (acpi_status) (0x0008 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_ELEMENT    (acpi_status) (0x0009 | AE_CODE_AML)
+#define AE_AML_NUMERIC_OVERFLOW         (acpi_status) (0x000A | AE_CODE_AML)
+#define AE_AML_REGION_LIMIT             (acpi_status) (0x000B | AE_CODE_AML)
+#define AE_AML_BUFFER_LIMIT             (acpi_status) (0x000C | AE_CODE_AML)
+#define AE_AML_PACKAGE_LIMIT            (acpi_status) (0x000D | AE_CODE_AML)
+#define AE_AML_DIVIDE_BY_ZERO           (acpi_status) (0x000E | AE_CODE_AML)
+#define AE_AML_BAD_NAME                 (acpi_status) (0x000F | AE_CODE_AML)
+#define AE_AML_NAME_NOT_FOUND           (acpi_status) (0x0010 | AE_CODE_AML)
+#define AE_AML_INTERNAL                 (acpi_status) (0x0011 | AE_CODE_AML)
+#define AE_AML_INVALID_SPACE_ID         (acpi_status) (0x0012 | AE_CODE_AML)
+#define AE_AML_STRING_LIMIT             (acpi_status) (0x0013 | AE_CODE_AML)
+#define AE_AML_NO_RETURN_VALUE          (acpi_status) (0x0014 | AE_CODE_AML)
+#define AE_AML_METHOD_LIMIT             (acpi_status) (0x0015 | AE_CODE_AML)
+#define AE_AML_NOT_OWNER                (acpi_status) (0x0016 | AE_CODE_AML)
+#define AE_AML_MUTEX_ORDER              (acpi_status) (0x0017 | AE_CODE_AML)
+#define AE_AML_MUTEX_NOT_ACQUIRED       (acpi_status) (0x0018 | AE_CODE_AML)
+#define AE_AML_INVALID_RESOURCE_TYPE    (acpi_status) (0x0019 | AE_CODE_AML)
+#define AE_AML_INVALID_INDEX            (acpi_status) (0x001A | AE_CODE_AML)
+#define AE_AML_REGISTER_LIMIT           (acpi_status) (0x001B | AE_CODE_AML)
+#define AE_AML_NO_WHILE                 (acpi_status) (0x001C | AE_CODE_AML)
+#define AE_AML_ALIGNMENT                (acpi_status) (0x001D | AE_CODE_AML)
+#define AE_AML_NO_RESOURCE_END_TAG      (acpi_status) (0x001E | AE_CODE_AML)
+#define AE_AML_BAD_RESOURCE_VALUE       (acpi_status) (0x001F | AE_CODE_AML)
+#define AE_AML_CIRCULAR_REFERENCE       (acpi_status) (0x0020 | AE_CODE_AML)
+#define AE_AML_BAD_RESOURCE_LENGTH      (acpi_status) (0x0021 | AE_CODE_AML)
+
+#define AE_CODE_AML_MAX                 0x0020
+
+/*
+ * Internal exceptions used for control
+ */
+#define AE_CTRL_RETURN_VALUE            (acpi_status) (0x0001 | AE_CODE_CONTROL)
+#define AE_CTRL_PENDING                 (acpi_status) (0x0002 | AE_CODE_CONTROL)
+#define AE_CTRL_TERMINATE               (acpi_status) (0x0003 | AE_CODE_CONTROL)
+#define AE_CTRL_TRUE                    (acpi_status) (0x0004 | AE_CODE_CONTROL)
+#define AE_CTRL_FALSE                   (acpi_status) (0x0005 | AE_CODE_CONTROL)
+#define AE_CTRL_DEPTH                   (acpi_status) (0x0006 | AE_CODE_CONTROL)
+#define AE_CTRL_END                     (acpi_status) (0x0007 | AE_CODE_CONTROL)
+#define AE_CTRL_TRANSFER                (acpi_status) (0x0008 | AE_CODE_CONTROL)
+#define AE_CTRL_BREAK                   (acpi_status) (0x0009 | AE_CODE_CONTROL)
+#define AE_CTRL_CONTINUE                (acpi_status) (0x000A | AE_CODE_CONTROL)
+#define AE_CTRL_SKIP                    (acpi_status) (0x000B | AE_CODE_CONTROL)
+
+#define AE_CODE_CTRL_MAX                0x000B
+
+
+#ifdef DEFINE_ACPI_GLOBALS
+
+/*
+ * String versions of the exception codes above
+ * These strings must match the corresponding defines exactly
+ */
+char const   *acpi_gbl_exception_names_env[] =
+{
+       "AE_OK",
+       "AE_ERROR",
+       "AE_NO_ACPI_TABLES",
+       "AE_NO_NAMESPACE",
+       "AE_NO_MEMORY",
+       "AE_NOT_FOUND",
+       "AE_NOT_EXIST",
+       "AE_ALREADY_EXISTS",
+       "AE_TYPE",
+       "AE_NULL_OBJECT",
+       "AE_NULL_ENTRY",
+       "AE_BUFFER_OVERFLOW",
+       "AE_STACK_OVERFLOW",
+       "AE_STACK_UNDERFLOW",
+       "AE_NOT_IMPLEMENTED",
+       "AE_VERSION_MISMATCH",
+       "AE_SUPPORT",
+       "AE_SHARE",
+       "AE_LIMIT",
+       "AE_TIME",
+       "AE_UNKNOWN_STATUS",
+       "AE_ACQUIRE_DEADLOCK",
+       "AE_RELEASE_DEADLOCK",
+       "AE_NOT_ACQUIRED",
+       "AE_ALREADY_ACQUIRED",
+       "AE_NO_HARDWARE_RESPONSE",
+       "AE_NO_GLOBAL_LOCK",
+       "AE_LOGICAL_ADDRESS",
+       "AE_ABORT_METHOD",
+       "AE_SAME_HANDLER"
+};
+
+char const   *acpi_gbl_exception_names_pgm[] =
+{
+       "AE_BAD_PARAMETER",
+       "AE_BAD_CHARACTER",
+       "AE_BAD_PATHNAME",
+       "AE_BAD_DATA",
+       "AE_BAD_ADDRESS",
+       "AE_ALIGNMENT",
+       "AE_BAD_HEX_CONSTANT",
+       "AE_BAD_OCTAL_CONSTANT",
+       "AE_BAD_DECIMAL_CONSTANT"
+};
+
+char const   *acpi_gbl_exception_names_tbl[] =
+{
+       "AE_BAD_SIGNATURE",
+       "AE_BAD_HEADER",
+       "AE_BAD_CHECKSUM",
+       "AE_BAD_VALUE",
+       "AE_TABLE_NOT_SUPPORTED",
+       "AE_INVALID_TABLE_LENGTH"
+};
+
+char const   *acpi_gbl_exception_names_aml[] =
+{
+       "AE_AML_ERROR",
+       "AE_AML_PARSE",
+       "AE_AML_BAD_OPCODE",
+       "AE_AML_NO_OPERAND",
+       "AE_AML_OPERAND_TYPE",
+       "AE_AML_OPERAND_VALUE",
+       "AE_AML_UNINITIALIZED_LOCAL",
+       "AE_AML_UNINITIALIZED_ARG",
+       "AE_AML_UNINITIALIZED_ELEMENT",
+       "AE_AML_NUMERIC_OVERFLOW",
+       "AE_AML_REGION_LIMIT",
+       "AE_AML_BUFFER_LIMIT",
+       "AE_AML_PACKAGE_LIMIT",
+       "AE_AML_DIVIDE_BY_ZERO",
+       "AE_AML_BAD_NAME",
+       "AE_AML_NAME_NOT_FOUND",
+       "AE_AML_INTERNAL",
+       "AE_AML_INVALID_SPACE_ID",
+       "AE_AML_STRING_LIMIT",
+       "AE_AML_NO_RETURN_VALUE",
+       "AE_AML_METHOD_LIMIT",
+       "AE_AML_NOT_OWNER",
+       "AE_AML_MUTEX_ORDER",
+       "AE_AML_MUTEX_NOT_ACQUIRED",
+       "AE_AML_INVALID_RESOURCE_TYPE",
+       "AE_AML_INVALID_INDEX",
+       "AE_AML_REGISTER_LIMIT",
+       "AE_AML_NO_WHILE",
+       "AE_AML_ALIGNMENT",
+       "AE_AML_NO_RESOURCE_END_TAG",
+       "AE_AML_BAD_RESOURCE_VALUE",
+       "AE_AML_CIRCULAR_REFERENCE",
+       "AE_AML_BAD_RESOURCE_LENGTH"
+};
+
+char const   *acpi_gbl_exception_names_ctrl[] =
+{
+       "AE_CTRL_RETURN_VALUE",
+       "AE_CTRL_PENDING",
+       "AE_CTRL_TERMINATE",
+       "AE_CTRL_TRUE",
+       "AE_CTRL_FALSE",
+       "AE_CTRL_DEPTH",
+       "AE_CTRL_END",
+       "AE_CTRL_TRANSFER",
+       "AE_CTRL_BREAK",
+       "AE_CTRL_CONTINUE",
+       "AE_CTRL_SKIP"
+};
+
+#endif /* ACPI GLOBALS */
+
+
+#endif /* __ACEXCEP_H__ */
diff --git a/xen/include/acpi/acglobal.h b/xen/include/acpi/acglobal.h
new file mode 100644 (file)
index 0000000..9cf587e
--- /dev/null
@@ -0,0 +1,310 @@
+/******************************************************************************
+ *
+ * Name: acglobal.h - Declarations for global variables
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACGLOBAL_H__
+#define __ACGLOBAL_H__
+
+
+/*
+ * Ensure that the globals are actually defined only once.
+ *
+ * The use of these defines allows a single list of globals (here) in order
+ * to simplify maintenance of the code.
+ */
+#ifdef DEFINE_ACPI_GLOBALS
+#define ACPI_EXTERN
+#else
+#define ACPI_EXTERN extern
+#endif
+
+
+/*****************************************************************************
+ *
+ * Debug support
+ *
+ ****************************************************************************/
+
+/* Runtime configuration of debug print levels */
+
+extern      u32                                 acpi_dbg_level;
+extern      u32                                 acpi_dbg_layer;
+
+/* Procedure nesting level for debug output */
+
+extern      u32                                 acpi_gbl_nesting_level;
+
+
+/*****************************************************************************
+ *
+ * ACPI Table globals
+ *
+ ****************************************************************************/
+
+/*
+ * Table pointers.
+ * Although these pointers are somewhat redundant with the global acpi_table,
+ * they are convenient because they are typed pointers.
+ *
+ * These tables are single-table only; meaning that there can be at most one
+ * of each in the system.  Each global points to the actual table.
+ *
+ */
+ACPI_EXTERN u32                                 acpi_gbl_table_flags;
+ACPI_EXTERN u32                                 acpi_gbl_rsdt_table_count;
+ACPI_EXTERN struct rsdp_descriptor             *acpi_gbl_RSDP;
+ACPI_EXTERN XSDT_DESCRIPTOR            *acpi_gbl_XSDT;
+ACPI_EXTERN FADT_DESCRIPTOR            *acpi_gbl_FADT;
+ACPI_EXTERN struct acpi_table_header           *acpi_gbl_DSDT;
+ACPI_EXTERN FACS_DESCRIPTOR            *acpi_gbl_FACS;
+ACPI_EXTERN struct acpi_common_facs             acpi_gbl_common_fACS;
+
+/*
+ * Handle both ACPI 1.0 and ACPI 2.0 Integer widths
+ * If we are running a method that exists in a 32-bit ACPI table.
+ * Use only 32 bits of the Integer for conversion.
+ */
+ACPI_EXTERN u8                                  acpi_gbl_integer_bit_width;
+ACPI_EXTERN u8                                  acpi_gbl_integer_byte_width;
+ACPI_EXTERN u8                                  acpi_gbl_integer_nybble_width;
+
+/* Keep local copies of these FADT-based registers */
+
+ACPI_EXTERN struct acpi_generic_address         acpi_gbl_xpm1a_enable;
+ACPI_EXTERN struct acpi_generic_address         acpi_gbl_xpm1b_enable;
+
+/*
+ * Since there may be multiple SSDTs and PSDTS, a single pointer is not
+ * sufficient; Therefore, there isn't one!
+ */
+
+
+/*
+ * ACPI Table info arrays
+ */
+extern      struct acpi_table_list              acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
+extern      struct acpi_table_support           acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES];
+
+/*
+ * Predefined mutex objects.  This array contains the
+ * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
+ * (The table maps local handles to the real OS handles)
+ */
+ACPI_EXTERN struct acpi_mutex_info              acpi_gbl_mutex_info[NUM_MUTEX];
+
+
+/*****************************************************************************
+ *
+ * Miscellaneous globals
+ *
+ ****************************************************************************/
+
+
+ACPI_EXTERN struct acpi_memory_list             acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS];
+ACPI_EXTERN struct acpi_object_notify_handler   acpi_gbl_device_notify;
+ACPI_EXTERN struct acpi_object_notify_handler   acpi_gbl_system_notify;
+ACPI_EXTERN acpi_init_handler                   acpi_gbl_init_handler;
+ACPI_EXTERN struct acpi_walk_state             *acpi_gbl_breakpoint_walk;
+ACPI_EXTERN acpi_handle                         acpi_gbl_global_lock_semaphore;
+
+ACPI_EXTERN u32                                 acpi_gbl_global_lock_thread_count;
+ACPI_EXTERN u32                                 acpi_gbl_original_mode;
+ACPI_EXTERN u32                                 acpi_gbl_rsdp_original_location;
+ACPI_EXTERN u32                                 acpi_gbl_ns_lookup_count;
+ACPI_EXTERN u32                                 acpi_gbl_ps_find_count;
+ACPI_EXTERN u16                                 acpi_gbl_pm1_enable_register_save;
+ACPI_EXTERN u16                                 acpi_gbl_next_table_owner_id;
+ACPI_EXTERN u16                                 acpi_gbl_next_method_owner_id;
+ACPI_EXTERN u16                                 acpi_gbl_global_lock_handle;
+ACPI_EXTERN u8                                  acpi_gbl_debugger_configuration;
+ACPI_EXTERN u8                                  acpi_gbl_global_lock_acquired;
+ACPI_EXTERN u8                                  acpi_gbl_step_to_next_call;
+ACPI_EXTERN u8                                  acpi_gbl_acpi_hardware_present;
+ACPI_EXTERN u8                                  acpi_gbl_global_lock_present;
+ACPI_EXTERN u8                                  acpi_gbl_events_initialized;
+
+extern u8                                       acpi_gbl_shutdown;
+extern u32                                      acpi_gbl_startup_flags;
+extern const u8                                 acpi_gbl_decode_to8bit[8];
+extern const char                              *acpi_gbl_db_sleep_states[ACPI_S_STATE_COUNT];
+extern const struct acpi_opcode_info            acpi_gbl_aml_op_info[AML_NUM_OPCODES];
+extern const char                              *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
+
+
+/*****************************************************************************
+ *
+ * Namespace globals
+ *
+ ****************************************************************************/
+
+#define NUM_NS_TYPES                    ACPI_TYPE_INVALID+1
+
+#if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
+#define NUM_PREDEFINED_NAMES            10
+#else
+#define NUM_PREDEFINED_NAMES            9
+#endif
+
+ACPI_EXTERN struct acpi_namespace_node          acpi_gbl_root_node_struct;
+ACPI_EXTERN struct acpi_namespace_node         *acpi_gbl_root_node;
+
+extern const u8                                 acpi_gbl_ns_properties[NUM_NS_TYPES];
+extern const struct acpi_predefined_names       acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES];
+
+#ifdef ACPI_DEBUG_OUTPUT
+ACPI_EXTERN u32                                 acpi_gbl_current_node_count;
+ACPI_EXTERN u32                                 acpi_gbl_current_node_size;
+ACPI_EXTERN u32                                 acpi_gbl_max_concurrent_node_count;
+ACPI_EXTERN acpi_size                           acpi_gbl_entry_stack_pointer;
+ACPI_EXTERN acpi_size                           acpi_gbl_lowest_stack_pointer;
+ACPI_EXTERN u32                                 acpi_gbl_deepest_nesting;
+#endif
+
+/*****************************************************************************
+ *
+ * Interpreter globals
+ *
+ ****************************************************************************/
+
+
+ACPI_EXTERN struct acpi_thread_state           *acpi_gbl_current_walk_list;
+
+/* Control method single step flag */
+
+ACPI_EXTERN u8                                  acpi_gbl_cm_single_step;
+
+
+/*****************************************************************************
+ *
+ * Parser globals
+ *
+ ****************************************************************************/
+
+ACPI_EXTERN union acpi_parse_object            *acpi_gbl_parsed_namespace_root;
+
+/*****************************************************************************
+ *
+ * Hardware globals
+ *
+ ****************************************************************************/
+
+extern      struct acpi_bit_register_info       acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
+ACPI_EXTERN u8                                  acpi_gbl_sleep_type_a;
+ACPI_EXTERN u8                                  acpi_gbl_sleep_type_b;
+
+
+/*****************************************************************************
+ *
+ * Event and GPE globals
+ *
+ ****************************************************************************/
+
+extern      struct acpi_fixed_event_info        acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
+ACPI_EXTERN struct acpi_fixed_event_handler     acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
+ACPI_EXTERN struct acpi_gpe_xrupt_info         *acpi_gbl_gpe_xrupt_list_head;
+ACPI_EXTERN struct acpi_gpe_block_info         *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
+ACPI_EXTERN acpi_handle                         acpi_gbl_gpe_lock;
+
+
+/*****************************************************************************
+ *
+ * Debugger globals
+ *
+ ****************************************************************************/
+
+
+ACPI_EXTERN u8                                  acpi_gbl_db_output_flags;
+
+#ifdef ACPI_DISASSEMBLER
+
+ACPI_EXTERN u8                                  acpi_gbl_db_opt_disasm;
+ACPI_EXTERN u8                                  acpi_gbl_db_opt_verbose;
+#endif
+
+
+#ifdef ACPI_DEBUGGER
+
+extern      u8                                  acpi_gbl_method_executing;
+extern      u8                                  acpi_gbl_abort_method;
+extern      u8                                  acpi_gbl_db_terminate_threads;
+
+ACPI_EXTERN int                                 optind;
+ACPI_EXTERN char                               *optarg;
+
+ACPI_EXTERN u8                                  acpi_gbl_db_opt_tables;
+ACPI_EXTERN u8                                  acpi_gbl_db_opt_stats;
+ACPI_EXTERN u8                                  acpi_gbl_db_opt_ini_methods;
+
+
+ACPI_EXTERN char                               *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
+ACPI_EXTERN char                                acpi_gbl_db_line_buf[80];
+ACPI_EXTERN char                                acpi_gbl_db_parsed_buf[80];
+ACPI_EXTERN char                                acpi_gbl_db_scope_buf[40];
+ACPI_EXTERN char                                acpi_gbl_db_debug_filename[40];
+ACPI_EXTERN u8                                  acpi_gbl_db_output_to_file;
+ACPI_EXTERN char                               *acpi_gbl_db_buffer;
+ACPI_EXTERN char                               *acpi_gbl_db_filename;
+ACPI_EXTERN u32                                 acpi_gbl_db_debug_level;
+ACPI_EXTERN u32                                 acpi_gbl_db_console_debug_level;
+ACPI_EXTERN struct acpi_table_header           *acpi_gbl_db_table_ptr;
+ACPI_EXTERN struct acpi_namespace_node         *acpi_gbl_db_scope_node;
+
+/*
+ * Statistic globals
+ */
+ACPI_EXTERN u16                                 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX+1];
+ACPI_EXTERN u16                                 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX+1];
+ACPI_EXTERN u16                                 acpi_gbl_obj_type_count_misc;
+ACPI_EXTERN u16                                 acpi_gbl_node_type_count_misc;
+ACPI_EXTERN u32                                 acpi_gbl_num_nodes;
+ACPI_EXTERN u32                                 acpi_gbl_num_objects;
+
+
+ACPI_EXTERN u32                                 acpi_gbl_size_of_parse_tree;
+ACPI_EXTERN u32                                 acpi_gbl_size_of_method_trees;
+ACPI_EXTERN u32                                 acpi_gbl_size_of_node_entries;
+ACPI_EXTERN u32                                 acpi_gbl_size_of_acpi_objects;
+
+#endif /* ACPI_DEBUGGER */
+
+
+#endif /* __ACGLOBAL_H__ */
diff --git a/xen/include/acpi/achware.h b/xen/include/acpi/achware.h
new file mode 100644 (file)
index 0000000..cfcff91
--- /dev/null
@@ -0,0 +1,177 @@
+/******************************************************************************
+ *
+ * Name: achware.h -- hardware specific interfaces
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACHWARE_H__
+#define __ACHWARE_H__
+
+
+/* PM Timer ticks per second (HZ) */
+#define PM_TIMER_FREQUENCY  3579545
+
+
+/* Prototypes */
+
+
+acpi_status
+acpi_hw_initialize (
+       void);
+
+acpi_status
+acpi_hw_shutdown (
+       void);
+
+acpi_status
+acpi_hw_initialize_system_info (
+       void);
+
+acpi_status
+acpi_hw_set_mode (
+       u32                             mode);
+
+u32
+acpi_hw_get_mode (
+       void);
+
+u32
+acpi_hw_get_mode_capabilities (
+       void);
+
+/* Register I/O Prototypes */
+
+struct acpi_bit_register_info *
+acpi_hw_get_bit_register_info (
+       u32                             register_id);
+
+acpi_status
+acpi_hw_register_read (
+       u8                              use_lock,
+       u32                             register_id,
+       u32                             *return_value);
+
+acpi_status
+acpi_hw_register_write (
+       u8                              use_lock,
+       u32                             register_id,
+       u32                             value);
+
+acpi_status
+acpi_hw_low_level_read (
+       u32                             width,
+       u32                             *value,
+       struct acpi_generic_address     *reg);
+
+acpi_status
+acpi_hw_low_level_write (
+       u32                             width,
+       u32                             value,
+       struct acpi_generic_address     *reg);
+
+acpi_status
+acpi_hw_clear_acpi_status (
+       u32                             flags);
+
+
+/* GPE support */
+
+acpi_status
+acpi_hw_enable_gpe (
+       struct acpi_gpe_event_info      *gpe_event_info);
+
+void
+acpi_hw_enable_gpe_for_wakeup (
+       struct acpi_gpe_event_info      *gpe_event_info);
+
+acpi_status
+acpi_hw_disable_gpe (
+       struct acpi_gpe_event_info      *gpe_event_info);
+
+acpi_status
+acpi_hw_disable_gpe_block (
+       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
+       struct acpi_gpe_block_info      *gpe_block);
+
+void
+acpi_hw_disable_gpe_for_wakeup (
+       struct acpi_gpe_event_info      *gpe_event_info);
+
+acpi_status
+acpi_hw_clear_gpe (
+       struct acpi_gpe_event_info      *gpe_event_info);
+
+acpi_status
+acpi_hw_clear_gpe_block (
+       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
+       struct acpi_gpe_block_info      *gpe_block);
+
+acpi_status
+acpi_hw_get_gpe_status (
+       struct acpi_gpe_event_info      *gpe_event_info,
+       acpi_event_status               *event_status);
+
+acpi_status
+acpi_hw_disable_non_wakeup_gpes (
+       void);
+
+acpi_status
+acpi_hw_enable_non_wakeup_gpes (
+       void);
+
+
+/* ACPI Timer prototypes */
+
+acpi_status
+acpi_get_timer_resolution (
+       u32                             *resolution);
+
+acpi_status
+acpi_get_timer (
+       u32                             *ticks);
+
+acpi_status
+acpi_get_timer_duration (
+       u32                             start_ticks,
+       u32                             end_ticks,
+       u32                             *time_elapsed);
+
+
+#endif /* __ACHWARE_H__ */
diff --git a/xen/include/acpi/acinterp.h b/xen/include/acpi/acinterp.h
new file mode 100644 (file)
index 0000000..0bcb194
--- /dev/null
@@ -0,0 +1,738 @@
+/******************************************************************************
+ *
+ * Name: acinterp.h - Interpreter subcomponent prototypes and defines
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACINTERP_H__
+#define __ACINTERP_H__
+
+
+#define ACPI_WALK_OPERANDS       (&(walk_state->operands [walk_state->num_operands -1]))
+
+
+acpi_status
+acpi_ex_resolve_operands (
+       u16                             opcode,
+       union acpi_operand_object       **stack_ptr,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_check_object_type (
+       acpi_object_type                type_needed,
+       acpi_object_type                this_type,
+       void                            *object);
+
+/*
+ * exxface - External interpreter interfaces
+ */
+
+acpi_status
+acpi_ex_load_table (
+       acpi_table_type                 table_id);
+
+acpi_status
+acpi_ex_execute_method (
+       struct acpi_namespace_node      *method_node,
+       union acpi_operand_object       **params,
+       union acpi_operand_object       **return_obj_desc);
+
+
+/*
+ * exconvrt - object conversion
+ */
+
+acpi_status
+acpi_ex_convert_to_integer (
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       **result_desc,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_convert_to_buffer (
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       **result_desc,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_convert_to_string (
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       **result_desc,
+       u32                             base,
+       u32                             max_length,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_convert_to_target_type (
+       acpi_object_type                destination_type,
+       union acpi_operand_object       *source_desc,
+       union acpi_operand_object       **result_desc,
+       struct acpi_walk_state          *walk_state);
+
+u32
+acpi_ex_convert_to_ascii (
+       acpi_integer                    integer,
+       u32                             base,
+       u8                              *string,
+       u8                              max_length);
+
+/*
+ * exfield - ACPI AML (p-code) execution - field manipulation
+ */
+
+acpi_status
+acpi_ex_extract_from_field (
+       union acpi_operand_object       *obj_desc,
+       void                            *buffer,
+       u32                             buffer_length);
+
+acpi_status
+acpi_ex_insert_into_field (
+       union acpi_operand_object       *obj_desc,
+       void                            *buffer,
+       u32                             buffer_length);
+
+acpi_status
+acpi_ex_setup_region (
+       union acpi_operand_object       *obj_desc,
+       u32                             field_datum_byte_offset);
+
+acpi_status
+acpi_ex_access_region (
+       union acpi_operand_object       *obj_desc,
+       u32                             field_datum_byte_offset,
+       acpi_integer                    *value,
+       u32                             read_write);
+
+u8
+acpi_ex_register_overflow (
+       union acpi_operand_object       *obj_desc,
+       acpi_integer                    value);
+
+acpi_status
+acpi_ex_field_datum_io (
+       union acpi_operand_object       *obj_desc,
+       u32                             field_datum_byte_offset,
+       acpi_integer                    *value,
+       u32                             read_write);
+
+acpi_status
+acpi_ex_write_with_update_rule (
+       union acpi_operand_object       *obj_desc,
+       acpi_integer                    mask,
+       acpi_integer                    field_value,
+       u32                             field_datum_byte_offset);
+
+void
+acpi_ex_get_buffer_datum(
+       acpi_integer                    *datum,
+       void                            *buffer,
+       u32                             buffer_length,
+       u32                             byte_granularity,
+       u32                             buffer_offset);
+
+void
+acpi_ex_set_buffer_datum (
+       acpi_integer                    merged_datum,
+       void                            *buffer,
+       u32                             buffer_length,
+       u32                             byte_granularity,
+       u32                             buffer_offset);
+
+acpi_status
+acpi_ex_read_data_from_field (
+       struct acpi_walk_state          *walk_state,
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       **ret_buffer_desc);
+
+acpi_status
+acpi_ex_write_data_to_field (
+       union acpi_operand_object       *source_desc,
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       **result_desc);
+
+/*
+ * exmisc - ACPI AML (p-code) execution - specific opcodes
+ */
+
+acpi_status
+acpi_ex_opcode_3A_0T_0R (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_opcode_3A_1T_1R (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_opcode_6A_0T_1R (
+       struct acpi_walk_state          *walk_state);
+
+u8
+acpi_ex_do_match (
+       u32                             match_op,
+       acpi_integer                    package_value,
+       acpi_integer                    match_value);
+
+acpi_status
+acpi_ex_get_object_reference (
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       **return_desc,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_resolve_multiple (
+       struct acpi_walk_state          *walk_state,
+       union acpi_operand_object       *operand,
+       acpi_object_type                *return_type,
+       union acpi_operand_object       **return_desc);
+
+acpi_status
+acpi_ex_concat_template (
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       *obj_desc2,
+       union acpi_operand_object       **actual_return_desc,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_do_concatenate (
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       *obj_desc2,
+       union acpi_operand_object       **actual_return_desc,
+       struct acpi_walk_state          *walk_state);
+
+u8
+acpi_ex_do_logical_op (
+       u16                             opcode,
+       acpi_integer                    operand0,
+       acpi_integer                    operand1);
+
+acpi_integer
+acpi_ex_do_math_op (
+       u16                             opcode,
+       acpi_integer                    operand0,
+       acpi_integer                    operand1);
+
+acpi_status
+acpi_ex_create_mutex (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_create_processor (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_create_power_resource (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_create_region (
+       u8                              *aml_start,
+       u32                             aml_length,
+       u8                              region_space,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_create_table_region (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_create_event (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_create_alias (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_create_method (
+       u8                              *aml_start,
+       u32                             aml_length,
+       struct acpi_walk_state          *walk_state);
+
+
+/*
+ * exconfig - dynamic table load/unload
+ */
+
+acpi_status
+acpi_ex_add_table (
+       struct acpi_table_header        *table,
+       struct acpi_namespace_node      *parent_node,
+       union acpi_operand_object       **ddb_handle);
+
+acpi_status
+acpi_ex_load_op (
+       union acpi_operand_object       *obj_desc,
+       union acpi_operand_object       *target,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_load_table_op (
+       struct acpi_walk_state          *walk_state,
+       union acpi_operand_object       **return_desc);
+
+acpi_status
+acpi_ex_unload_table (
+       union acpi_operand_object       *ddb_handle);
+
+
+/*
+ * exmutex - mutex support
+ */
+
+acpi_status
+acpi_ex_acquire_mutex (
+       union acpi_operand_object       *time_desc,
+       union acpi_operand_object       *obj_desc,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_release_mutex (
+       union acpi_operand_object       *obj_desc,
+       struct acpi_walk_state          *walk_state);
+
+void
+acpi_ex_release_all_mutexes (
+       struct acpi_thread_state        *thread);
+
+void
+acpi_ex_unlink_mutex (
+       union acpi_operand_object       *obj_desc);
+
+void
+acpi_ex_link_mutex (
+       union acpi_operand_object       *obj_desc,
+       struct acpi_thread_state        *thread);
+
+/*
+ * exprep - ACPI AML (p-code) execution - prep utilities
+ */
+
+acpi_status
+acpi_ex_prep_common_field_object (
+       union acpi_operand_object       *obj_desc,
+       u8                              field_flags,
+       u8                              field_attribute,
+       u32                             field_bit_position,
+       u32                             field_bit_length);
+
+acpi_status
+acpi_ex_prep_field_value (
+       struct acpi_create_field_info   *info);
+
+/*
+ * exsystem - Interface to OS services
+ */
+
+acpi_status
+acpi_ex_system_do_notify_op (
+       union acpi_operand_object       *value,
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ex_system_do_suspend(
+       u32                             time);
+
+acpi_status
+acpi_ex_system_do_stall (
+       u32                             time);
+
+acpi_status
+acpi_ex_system_acquire_mutex(
+       union acpi_operand_object       *time,
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ex_system_release_mutex(
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ex_system_signal_event(
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ex_system_wait_event(
+       union acpi_operand_object       *time,
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ex_system_reset_event(
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ex_system_wait_semaphore (
+       acpi_handle                     semaphore,
+       u16                             timeout);
+
+
+/*
+ * exmonadic - ACPI AML (p-code) execution, monadic operators
+ */
+
+acpi_status
+acpi_ex_opcode_1A_0T_0R (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_opcode_1A_0T_1R (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_opcode_1A_1T_1R (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_opcode_1A_1T_0R (
+       struct acpi_walk_state          *walk_state);
+
+/*
+ * exdyadic - ACPI AML (p-code) execution, dyadic operators
+ */
+
+acpi_status
+acpi_ex_opcode_2A_0T_0R (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_opcode_2A_0T_1R (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_opcode_2A_1T_1R (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_opcode_2A_2T_1R (
+       struct acpi_walk_state          *walk_state);
+
+
+/*
+ * exresolv  - Object resolution and get value functions
+ */
+
+acpi_status
+acpi_ex_resolve_to_value (
+       union acpi_operand_object       **stack_ptr,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_resolve_node_to_value (
+       struct acpi_namespace_node      **stack_ptr,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_resolve_object_to_value (
+       union acpi_operand_object       **stack_ptr,
+       struct acpi_walk_state          *walk_state);
+
+
+/*
+ * exdump - Scanner debug output routines
+ */
+
+void
+acpi_ex_dump_operand (
+       union acpi_operand_object       *entry_desc);
+
+void
+acpi_ex_dump_operands (
+       union acpi_operand_object       **operands,
+       acpi_interpreter_mode           interpreter_mode,
+       char                            *ident,
+       u32                             num_levels,
+       char                            *note,
+       char                            *module_name,
+       u32                             line_number);
+
+void
+acpi_ex_dump_object_descriptor (
+       union acpi_operand_object       *object,
+       u32                             flags);
+
+void
+acpi_ex_dump_node (
+       struct acpi_namespace_node      *node,
+       u32                             flags);
+
+void
+acpi_ex_out_string (
+       char                            *title,
+       char                            *value);
+
+void
+acpi_ex_out_pointer (
+       char                            *title,
+       void                            *value);
+
+void
+acpi_ex_out_integer (
+       char                            *title,
+       u32                             value);
+
+void
+acpi_ex_out_address (
+       char                            *title,
+       acpi_physical_address           value);
+
+
+/*
+ * exnames - interpreter/scanner name load/execute
+ */
+
+char *
+acpi_ex_allocate_name_string (
+       u32                             prefix_count,
+       u32                             num_name_segs);
+
+u32
+acpi_ex_good_char (
+       u32                             character);
+
+acpi_status
+acpi_ex_name_segment (
+       u8                              **in_aml_address,
+       char                            *name_string);
+
+acpi_status
+acpi_ex_get_name_string (
+       acpi_object_type                data_type,
+       u8                              *in_aml_address,
+       char                            **out_name_string,
+       u32                             *out_name_length);
+
+acpi_status
+acpi_ex_do_name (
+       acpi_object_type                data_type,
+       acpi_interpreter_mode           load_exec_mode);
+
+
+/*
+ * exstore - Object store support
+ */
+
+acpi_status
+acpi_ex_store (
+       union acpi_operand_object       *val_desc,
+       union acpi_operand_object       *dest_desc,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_store_object_to_index (
+       union acpi_operand_object       *val_desc,
+       union acpi_operand_object       *dest_desc,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_store_object_to_node (
+       union acpi_operand_object       *source_desc,
+       struct acpi_namespace_node      *node,
+       struct acpi_walk_state          *walk_state);
+
+
+/*
+ * exstoren
+ */
+
+acpi_status
+acpi_ex_resolve_object (
+       union acpi_operand_object       **source_desc_ptr,
+       acpi_object_type                target_type,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ex_store_object_to_object (
+       union acpi_operand_object       *source_desc,
+       union acpi_operand_object       *dest_desc,
+       union acpi_operand_object       **new_desc,
+       struct acpi_walk_state          *walk_state);
+
+
+/*
+ * excopy - object copy
+ */
+
+acpi_status
+acpi_ex_store_buffer_to_buffer (
+       union acpi_operand_object       *source_desc,
+       union acpi_operand_object       *target_desc);
+
+acpi_status
+acpi_ex_store_string_to_string (
+       union acpi_operand_object       *source_desc,
+       union acpi_operand_object       *target_desc);
+
+acpi_status
+acpi_ex_copy_integer_to_index_field (
+       union acpi_operand_object       *source_desc,
+       union acpi_operand_object       *target_desc);
+
+acpi_status
+acpi_ex_copy_integer_to_bank_field (
+       union acpi_operand_object       *source_desc,
+       union acpi_operand_object       *target_desc);
+
+acpi_status
+acpi_ex_copy_data_to_named_field (
+       union acpi_operand_object       *source_desc,
+       struct acpi_namespace_node      *node);
+
+acpi_status
+acpi_ex_copy_integer_to_buffer_field (
+       union acpi_operand_object       *source_desc,
+       union acpi_operand_object       *target_desc);
+
+/*
+ * exutils - interpreter/scanner utilities
+ */
+
+acpi_status
+acpi_ex_enter_interpreter (
+       void);
+
+void
+acpi_ex_exit_interpreter (
+       void);
+
+void
+acpi_ex_truncate_for32bit_table (
+       union acpi_operand_object       *obj_desc);
+
+u8
+acpi_ex_acquire_global_lock (
+       u32                             rule);
+
+void
+acpi_ex_release_global_lock (
+       u8                              locked);
+
+u32
+acpi_ex_digits_needed (
+       acpi_integer                    value,
+       u32                             base);
+
+void
+acpi_ex_eisa_id_to_string (
+       u32                             numeric_id,
+       char                            *out_string);
+
+void
+acpi_ex_unsigned_integer_to_string (
+       acpi_integer                    value,
+       char                            *out_string);
+
+
+/*
+ * exregion - default op_region handlers
+ */
+
+acpi_status
+acpi_ex_system_memory_space_handler (
+       u32                             function,
+       acpi_physical_address           address,
+       u32                             bit_width,
+       acpi_integer                    *value,
+       void                            *handler_context,
+       void                            *region_context);
+
+acpi_status
+acpi_ex_system_io_space_handler (
+       u32                             function,
+       acpi_physical_address           address,
+       u32                             bit_width,
+       acpi_integer                    *value,
+       void                            *handler_context,
+       void                            *region_context);
+
+acpi_status
+acpi_ex_pci_config_space_handler (
+       u32                             function,
+       acpi_physical_address           address,
+       u32                             bit_width,
+       acpi_integer                    *value,
+       void                            *handler_context,
+       void                            *region_context);
+
+acpi_status
+acpi_ex_cmos_space_handler (
+       u32                             function,
+       acpi_physical_address           address,
+       u32                             bit_width,
+       acpi_integer                    *value,
+       void                            *handler_context,
+       void                            *region_context);
+
+acpi_status
+acpi_ex_pci_bar_space_handler (
+       u32                             function,
+       acpi_physical_address           address,
+       u32                             bit_width,
+       acpi_integer                    *value,
+       void                            *handler_context,
+       void                            *region_context);
+
+acpi_status
+acpi_ex_embedded_controller_space_handler (
+       u32                             function,
+       acpi_physical_address           address,
+       u32                             bit_width,
+       acpi_integer                    *value,
+       void                            *handler_context,
+       void                            *region_context);
+
+acpi_status
+acpi_ex_sm_bus_space_handler (
+       u32                             function,
+       acpi_physical_address           address,
+       u32                             bit_width,
+       acpi_integer                    *value,
+       void                            *handler_context,
+       void                            *region_context);
+
+
+acpi_status
+acpi_ex_data_table_space_handler (
+       u32                             function,
+       acpi_physical_address           address,
+       u32                             bit_width,
+       acpi_integer                    *value,
+       void                            *handler_context,
+       void                            *region_context);
+
+#endif /* __INTERP_H__ */
diff --git a/xen/include/acpi/aclocal.h b/xen/include/acpi/aclocal.h
new file mode 100644 (file)
index 0000000..62c743b
--- /dev/null
@@ -0,0 +1,972 @@
+/******************************************************************************
+ *
+ * Name: aclocal.h - Internal data types used across the ACPI subsystem
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACLOCAL_H__
+#define __ACLOCAL_H__
+
+
+#define ACPI_WAIT_FOREVER               0xFFFF  /* u16, as per ACPI spec */
+
+typedef void *                                  acpi_mutex;
+typedef u32                                     acpi_mutex_handle;
+
+
+/* Total number of aml opcodes defined */
+
+#define AML_NUM_OPCODES                 0x7E
+
+
+/*****************************************************************************
+ *
+ * Mutex typedefs and structs
+ *
+ ****************************************************************************/
+
+
+/*
+ * Predefined handles for the mutex objects used within the subsystem
+ * All mutex objects are automatically created by acpi_ut_mutex_initialize.
+ *
+ * The acquire/release ordering protocol is implied via this list.  Mutexes
+ * with a lower value must be acquired before mutexes with a higher value.
+ *
+ * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also!
+ */
+
+#define ACPI_MTX_EXECUTE                0
+#define ACPI_MTX_INTERPRETER            1
+#define ACPI_MTX_PARSER                 2
+#define ACPI_MTX_DISPATCHER             3
+#define ACPI_MTX_TABLES                 4
+#define ACPI_MTX_OP_REGIONS             5
+#define ACPI_MTX_NAMESPACE              6
+#define ACPI_MTX_EVENTS                 7
+#define ACPI_MTX_HARDWARE               8
+#define ACPI_MTX_CACHES                 9
+#define ACPI_MTX_MEMORY                 10
+#define ACPI_MTX_DEBUG_CMD_COMPLETE     11
+#define ACPI_MTX_DEBUG_CMD_READY        12
+
+#define MAX_MUTEX                       12
+#define NUM_MUTEX                       MAX_MUTEX+1
+
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+#ifdef DEFINE_ACPI_GLOBALS
+
+/* Names for the mutexes used in the subsystem */
+
+static char                         *acpi_gbl_mutex_names[] =
+{
+       "ACPI_MTX_Execute",
+       "ACPI_MTX_Interpreter",
+       "ACPI_MTX_Parser",
+       "ACPI_MTX_Dispatcher",
+       "ACPI_MTX_Tables",
+       "ACPI_MTX_op_regions",
+       "ACPI_MTX_Namespace",
+       "ACPI_MTX_Events",
+       "ACPI_MTX_Hardware",
+       "ACPI_MTX_Caches",
+       "ACPI_MTX_Memory",
+       "ACPI_MTX_debug_cmd_complete",
+       "ACPI_MTX_debug_cmd_ready",
+};
+
+#endif
+#endif
+
+
+/* Table for the global mutexes */
+
+struct acpi_mutex_info
+{
+       acpi_mutex                          mutex;
+       u32                                 use_count;
+       u32                                 owner_id;
+};
+
+/* This owner ID means that the mutex is not in use (unlocked) */
+
+#define ACPI_MUTEX_NOT_ACQUIRED         (u32) (-1)
+
+
+/* Lock flag parameter for various interfaces */
+
+#define ACPI_MTX_DO_NOT_LOCK            0
+#define ACPI_MTX_LOCK                   1
+
+
+typedef u16                                     acpi_owner_id;
+#define ACPI_OWNER_TYPE_TABLE           0x0
+#define ACPI_OWNER_TYPE_METHOD          0x1
+#define ACPI_FIRST_METHOD_ID            0x0001
+#define ACPI_FIRST_TABLE_ID             0xF000
+
+
+/* Field access granularities */
+
+#define ACPI_FIELD_BYTE_GRANULARITY     1
+#define ACPI_FIELD_WORD_GRANULARITY     2
+#define ACPI_FIELD_DWORD_GRANULARITY    4
+#define ACPI_FIELD_QWORD_GRANULARITY    8
+
+/*****************************************************************************
+ *
+ * Namespace typedefs and structs
+ *
+ ****************************************************************************/
+
+
+/* Operational modes of the AML interpreter/scanner */
+
+typedef enum
+{
+       ACPI_IMODE_LOAD_PASS1               = 0x01,
+       ACPI_IMODE_LOAD_PASS2               = 0x02,
+       ACPI_IMODE_EXECUTE                  = 0x0E
+
+} acpi_interpreter_mode;
+
+
+/*
+ * The Node describes a named object that appears in the AML
+ * An acpi_node is used to store Nodes.
+ *
+ * data_type is used to differentiate between internal descriptors, and MUST
+ * be the first byte in this structure.
+ */
+
+union acpi_name_union
+{
+       u32                                 integer;
+       char                                ascii[4];
+};
+
+struct acpi_namespace_node
+{
+       u8                                  descriptor;     /* Used to differentiate object descriptor types */
+       u8                                  type;           /* Type associated with this name */
+       u16                                 owner_id;
+       union acpi_name_union               name;           /* ACPI Name, always 4 chars per ACPI spec */
+
+
+       union acpi_operand_object           *object;        /* Pointer to attached ACPI object (optional) */
+       struct acpi_namespace_node          *child;         /* First child */
+       struct acpi_namespace_node          *peer;          /* Next peer*/
+       u16                                 reference_count; /* Current count of references and children */
+       u8                                  flags;
+};
+
+
+#define ACPI_ENTRY_NOT_FOUND            NULL
+
+
+/* Node flags */
+
+#define ANOBJ_RESERVED                  0x01
+#define ANOBJ_END_OF_PEER_LIST          0x02
+#define ANOBJ_DATA_WIDTH_32             0x04     /* Parent table is 64-bits */
+#define ANOBJ_METHOD_ARG                0x08
+#define ANOBJ_METHOD_LOCAL              0x10
+#define ANOBJ_METHOD_NO_RETVAL          0x20
+#define ANOBJ_METHOD_SOME_NO_RETVAL     0x40
+
+#define ANOBJ_IS_BIT_OFFSET             0x80
+
+
+/*
+ * ACPI Table Descriptor.  One per ACPI table
+ */
+struct acpi_table_desc
+{
+       struct acpi_table_desc          *prev;
+       struct acpi_table_desc          *next;
+       struct acpi_table_desc          *installed_desc;
+       struct acpi_table_header        *pointer;
+       u8                              *aml_start;
+       u64                             physical_address;
+       u32                             aml_length;
+       acpi_size                       length;
+       acpi_owner_id                   table_id;
+       u8                              type;
+       u8                              allocation;
+       u8                              loaded_into_namespace;
+};
+
+struct acpi_table_list
+{
+       struct acpi_table_desc          *next;
+       u32                             count;
+};
+
+
+struct acpi_find_context
+{
+       char                            *search_for;
+       acpi_handle                     *list;
+       u32                             *count;
+};
+
+
+struct acpi_ns_search_data
+{
+       struct acpi_namespace_node      *node;
+};
+
+
+/*
+ * Predefined Namespace items
+ */
+struct acpi_predefined_names
+{
+       char                            *name;
+       u8                              type;
+       char                            *val;
+};
+
+
+/* Object types used during package copies */
+
+
+#define ACPI_COPY_TYPE_SIMPLE           0
+#define ACPI_COPY_TYPE_PACKAGE          1
+
+/* Info structure used to convert external<->internal namestrings */
+
+struct acpi_namestring_info
+{
+       char                            *external_name;
+       char                            *next_external_char;
+       char                            *internal_name;
+       u32                             length;
+       u32                             num_segments;
+       u32                             num_carats;
+       u8                              fully_qualified;
+};
+
+
+/* Field creation info */
+
+struct acpi_create_field_info
+{
+       struct acpi_namespace_node      *region_node;
+       struct acpi_namespace_node      *field_node;
+       struct acpi_namespace_node      *register_node;
+       struct acpi_namespace_node      *data_register_node;
+       u32                             bank_value;
+       u32                             field_bit_position;
+       u32                             field_bit_length;
+       u8                              field_flags;
+       u8                              attribute;
+       u8                              field_type;
+};
+
+
+/*****************************************************************************
+ *
+ * Event typedefs and structs
+ *
+ ****************************************************************************/
+
+/* Information about a GPE, one per each GPE in an array */
+
+struct acpi_gpe_event_info
+{
+       struct acpi_namespace_node              *method_node;   /* Method node for this GPE level */
+       acpi_gpe_handler                        handler;        /* Address of handler, if any */
+       void                                    *context;       /* Context to be passed to handler */
+       struct acpi_gpe_register_info           *register_info; /* Backpointer to register info */
+       u8                                      flags;          /* Level or Edge */
+       u8                                      bit_mask;       /* This GPE within the register */
+};
+
+/* Information about a GPE register pair, one per each status/enable pair in an array */
+
+struct acpi_gpe_register_info
+{
+       struct acpi_generic_address             status_address; /* Address of status reg */
+       struct acpi_generic_address             enable_address; /* Address of enable reg */
+       u8                                      status;         /* Current value of status reg */
+       u8                                      enable;         /* Current value of enable reg */
+       u8                                      wake_enable;    /* Mask of bits to keep enabled when sleeping */
+       u8                                      base_gpe_number; /* Base GPE number for this register */
+};
+
+/*
+ * Information about a GPE register block, one per each installed block --
+ * GPE0, GPE1, and one per each installed GPE Block Device.
+ */
+struct acpi_gpe_block_info
+{
+       struct acpi_gpe_block_info              *previous;
+       struct acpi_gpe_block_info              *next;
+       struct acpi_gpe_xrupt_info              *xrupt_block;   /* Backpointer to interrupt block */
+       struct acpi_gpe_register_info           *register_info; /* One per GPE register pair */
+       struct acpi_gpe_event_info              *event_info;    /* One for each GPE */
+       struct acpi_generic_address             block_address;  /* Base address of the block */
+       u32                                     register_count; /* Number of register pairs in block */
+       u8                                      block_base_number;/* Base GPE number for this block */
+};
+
+/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
+
+struct acpi_gpe_xrupt_info
+{
+       struct acpi_gpe_xrupt_info              *previous;
+       struct acpi_gpe_xrupt_info              *next;
+       struct acpi_gpe_block_info              *gpe_block_list_head; /* List of GPE blocks for this xrupt */
+       u32                                     interrupt_level;    /* System interrupt level */
+};
+
+
+typedef acpi_status (*ACPI_GPE_CALLBACK) (
+       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
+       struct acpi_gpe_block_info      *gpe_block);
+
+
+/* Information about each particular fixed event */
+
+struct acpi_fixed_event_handler
+{
+       acpi_event_handler              handler;        /* Address of handler. */
+       void                            *context;       /* Context to be passed to handler */
+};
+
+struct acpi_fixed_event_info
+{
+       u8                              status_register_id;
+       u8                              enable_register_id;
+       u16                             status_bit_mask;
+       u16                             enable_bit_mask;
+};
+
+/* Information used during field processing */
+
+struct acpi_field_info
+{
+       u8                              skip_field;
+       u8                              field_flag;
+       u32                             pkg_length;
+};
+
+
+/*****************************************************************************
+ *
+ * Generic "state" object for stacks
+ *
+ ****************************************************************************/
+
+
+#define ACPI_CONTROL_NORMAL                  0xC0
+#define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
+#define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
+#define ACPI_CONTROL_PREDICATE_FALSE         0xC3
+#define ACPI_CONTROL_PREDICATE_TRUE          0xC4
+
+
+/* Forward declarations */
+struct acpi_walk_state        ;
+struct acpi_obj_mutex;
+union acpi_parse_object        ;
+
+
+#define ACPI_STATE_COMMON                  /* Two 32-bit fields and a pointer */\
+       u8                                  data_type;          /* To differentiate various internal objs */\
+       u8                                  flags;      \
+       u16                                 value;      \
+       u16                                 state;      \
+       u16                                 reserved;   \
+       void                                *next;      \
+
+struct acpi_common_state
+{
+       ACPI_STATE_COMMON
+};
+
+
+/*
+ * Update state - used to traverse complex objects such as packages
+ */
+struct acpi_update_state
+{
+       ACPI_STATE_COMMON
+       union acpi_operand_object           *object;
+};
+
+
+/*
+ * Pkg state - used to traverse nested package structures
+ */
+struct acpi_pkg_state
+{
+       ACPI_STATE_COMMON
+       union acpi_operand_object           *source_object;
+       union acpi_operand_object           *dest_object;
+       struct acpi_walk_state              *walk_state;
+       void                                *this_target_obj;
+       u32                                 num_packages;
+       u16                                 index;
+};
+
+
+/*
+ * Control state - one per if/else and while constructs.
+ * Allows nesting of these constructs
+ */
+struct acpi_control_state
+{
+       ACPI_STATE_COMMON
+       union acpi_parse_object             *predicate_op;
+       u8                                  *aml_predicate_start;   /* Start of if/while predicate */
+       u8                                  *package_end;           /* End of if/while block */
+       u16                                 opcode;
+};
+
+
+/*
+ * Scope state - current scope during namespace lookups
+ */
+struct acpi_scope_state
+{
+       ACPI_STATE_COMMON
+       struct acpi_namespace_node          *node;
+};
+
+
+struct acpi_pscope_state
+{
+       ACPI_STATE_COMMON
+       union acpi_parse_object             *op;                    /* Current op being parsed */
+       u8                                  *arg_end;               /* Current argument end */
+       u8                                  *pkg_end;               /* Current package end */
+       u32                                 arg_list;               /* Next argument to parse */
+       u32                                 arg_count;              /* Number of fixed arguments */
+};
+
+
+/*
+ * Thread state - one per thread across multiple walk states.  Multiple walk
+ * states are created when there are nested control methods executing.
+ */
+struct acpi_thread_state
+{
+       ACPI_STATE_COMMON
+       struct acpi_walk_state              *walk_state_list;       /* Head of list of walk_states for this thread */
+       union acpi_operand_object           *acquired_mutex_list;   /* List of all currently acquired mutexes */
+       u32                                 thread_id;              /* Running thread ID */
+       u16                                 current_sync_level;     /* Mutex Sync (nested acquire) level */
+};
+
+
+/*
+ * Result values - used to accumulate the results of nested
+ * AML arguments
+ */
+struct acpi_result_values
+{
+       ACPI_STATE_COMMON
+       union acpi_operand_object           *obj_desc [ACPI_OBJ_NUM_OPERANDS];
+       u8                                  num_results;
+       u8                                  last_insert;
+};
+
+
+typedef
+acpi_status (*acpi_parse_downwards) (
+       struct acpi_walk_state              *walk_state,
+       union acpi_parse_object             **out_op);
+
+typedef
+acpi_status (*acpi_parse_upwards) (
+       struct acpi_walk_state              *walk_state);
+
+
+/*
+ * Notify info - used to pass info to the deferred notify
+ * handler/dispatcher.
+ */
+struct acpi_notify_info
+{
+       ACPI_STATE_COMMON
+       struct acpi_namespace_node          *node;
+       union acpi_operand_object           *handler_obj;
+};
+
+
+/* Generic state is union of structs above */
+
+union acpi_generic_state
+{
+       struct acpi_common_state            common;
+       struct acpi_control_state           control;
+       struct acpi_update_state            update;
+       struct acpi_scope_state             scope;
+       struct acpi_pscope_state            parse_scope;
+       struct acpi_pkg_state               pkg;
+       struct acpi_thread_state            thread;
+       struct acpi_result_values           results;
+       struct acpi_notify_info             notify;
+};
+
+
+/*****************************************************************************
+ *
+ * Interpreter typedefs and structs
+ *
+ ****************************************************************************/
+
+typedef
+acpi_status (*ACPI_EXECUTE_OP) (
+       struct acpi_walk_state              *walk_state);
+
+
+/*****************************************************************************
+ *
+ * Parser typedefs and structs
+ *
+ ****************************************************************************/
+
+/*
+ * AML opcode, name, and argument layout
+ */
+struct acpi_opcode_info
+{
+#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
+       char                                *name;          /* Opcode name (disassembler/debug only) */
+#endif
+       u32                                 parse_args;     /* Grammar/Parse time arguments */
+       u32                                 runtime_args;   /* Interpret time arguments */
+       u32                                 flags;          /* Misc flags */
+       u8                                  object_type;    /* Corresponding internal object type */
+       u8                                  class;          /* Opcode class */
+       u8                                  type;           /* Opcode type */
+};
+
+
+union acpi_parse_value
+{
+       acpi_integer                        integer;        /* Integer constant (Up to 64 bits) */
+       struct uint64_struct                integer64;      /* Structure overlay for 2 32-bit Dwords */
+       u32                                 size;           /* bytelist or field size */
+       char                                *string;        /* NULL terminated string */
+       u8                                  *buffer;        /* buffer or string */
+       char                                *name;          /* NULL terminated string */
+       union acpi_parse_object             *arg;           /* arguments and contained ops */
+};
+
+
+#define ACPI_PARSE_COMMON \
+       u8                                  data_type;      /* To differentiate various internal objs */\
+       u8                                  flags;          /* Type of Op */\
+       u16                                 aml_opcode;     /* AML opcode */\
+       u32                                 aml_offset;     /* Offset of declaration in AML */\
+       union acpi_parse_object             *parent;        /* Parent op */\
+       union acpi_parse_object             *next;          /* Next op */\
+       ACPI_DISASM_ONLY_MEMBERS (\
+       u8                                  disasm_flags;   /* Used during AML disassembly */\
+       u8                                  disasm_opcode;  /* Subtype used for disassembly */\
+       char                                aml_op_name[16]) /* Op name (debug only) */\
+                          /* NON-DEBUG members below: */\
+       struct acpi_namespace_node          *node;          /* For use by interpreter */\
+       union acpi_parse_value              value;          /* Value or args associated with the opcode */\
+
+
+#define ACPI_DASM_BUFFER        0x00
+#define ACPI_DASM_RESOURCE      0x01
+#define ACPI_DASM_STRING        0x02
+#define ACPI_DASM_UNICODE       0x03
+#define ACPI_DASM_EISAID        0x04
+#define ACPI_DASM_MATCHOP       0x05
+
+/*
+ * generic operation (for example:  If, While, Store)
+ */
+struct acpi_parse_obj_common
+{
+       ACPI_PARSE_COMMON
+};
+
+
+/*
+ * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
+ * and bytelists.
+ */
+struct acpi_parse_obj_named
+{
+       ACPI_PARSE_COMMON
+       u8                                  *path;
+       u8                                  *data;          /* AML body or bytelist data */
+       u32                                 length;         /* AML length */
+       u32                                 name;           /* 4-byte name or zero if no name */
+};
+
+
+/* The parse node is the fundamental element of the parse tree */
+
+struct acpi_parse_obj_asl
+{
+       ACPI_PARSE_COMMON
+       union acpi_parse_object             *child;
+       union acpi_parse_object             *parent_method;
+       char                                *filename;
+       char                                *external_name;
+       char                                *namepath;
+       char                                name_seg[4];
+       u32                                 extra_value;
+       u32                                 column;
+       u32                                 line_number;
+       u32                                 logical_line_number;
+       u32                                 logical_byte_offset;
+       u32                                 end_line;
+       u32                                 end_logical_line;
+       u32                                 acpi_btype;
+       u32                                 aml_length;
+       u32                                 aml_subtree_length;
+       u32                                 final_aml_length;
+       u32                                 final_aml_offset;
+       u32                                 compile_flags;
+       u16                                 parse_opcode;
+       u8                                  aml_opcode_length;
+       u8                                  aml_pkg_len_bytes;
+       u8                                  extra;
+       char                                parse_op_name[12];
+};
+
+
+union acpi_parse_object
+{
+       struct acpi_parse_obj_common        common;
+       struct acpi_parse_obj_named         named;
+       struct acpi_parse_obj_asl           asl;
+};
+
+
+/*
+ * Parse state - one state per parser invocation and each control
+ * method.
+ */
+struct acpi_parse_state
+{
+       u32                                 aml_size;
+       u8                                  *aml_start;     /* First AML byte */
+       u8                                  *aml;           /* Next AML byte */
+       u8                                  *aml_end;       /* (last + 1) AML byte */
+       u8                                  *pkg_start;     /* Current package begin */
+       u8                                  *pkg_end;       /* Current package end */
+       union acpi_parse_object             *start_op;      /* Root of parse tree */
+       struct acpi_namespace_node          *start_node;
+       union acpi_generic_state            *scope;         /* Current scope */
+       union acpi_parse_object             *start_scope;
+};
+
+
+/* Parse object flags */
+
+#define ACPI_PARSEOP_GENERIC                    0x01
+#define ACPI_PARSEOP_NAMED                      0x02
+#define ACPI_PARSEOP_DEFERRED                   0x04
+#define ACPI_PARSEOP_BYTELIST                   0x08
+#define ACPI_PARSEOP_IN_CACHE                   0x80
+
+/* Parse object disasm_flags */
+
+#define ACPI_PARSEOP_IGNORE                     0x01
+#define ACPI_PARSEOP_PARAMLIST                  0x02
+#define ACPI_PARSEOP_EMPTY_TERMLIST             0x04
+#define ACPI_PARSEOP_SPECIAL                    0x10
+
+
+/*****************************************************************************
+ *
+ * Hardware (ACPI registers) and PNP
+ *
+ ****************************************************************************/
+
+#define PCI_ROOT_HID_STRING         "PNP0A03"
+
+struct acpi_bit_register_info
+{
+       u8                                  parent_register;
+       u8                                  bit_position;
+       u16                                 access_bit_mask;
+};
+
+
+/*
+ * Register IDs
+ * These are the full ACPI registers
+ */
+#define ACPI_REGISTER_PM1_STATUS                0x01
+#define ACPI_REGISTER_PM1_ENABLE                0x02
+#define ACPI_REGISTER_PM1_CONTROL               0x03
+#define ACPI_REGISTER_PM1A_CONTROL              0x04
+#define ACPI_REGISTER_PM1B_CONTROL              0x05
+#define ACPI_REGISTER_PM2_CONTROL               0x06
+#define ACPI_REGISTER_PM_TIMER                  0x07
+#define ACPI_REGISTER_PROCESSOR_BLOCK           0x08
+#define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x09
+
+
+/* Masks used to access the bit_registers */
+
+#define ACPI_BITMASK_TIMER_STATUS               0x0001
+#define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
+#define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
+#define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
+#define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
+#define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
+#define ACPI_BITMASK_WAKE_STATUS                0x8000
+
+#define ACPI_BITMASK_ALL_FIXED_STATUS           (ACPI_BITMASK_TIMER_STATUS          | \
+                        ACPI_BITMASK_BUS_MASTER_STATUS     | \
+                        ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
+                        ACPI_BITMASK_POWER_BUTTON_STATUS   | \
+                        ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
+                        ACPI_BITMASK_RT_CLOCK_STATUS       | \
+                        ACPI_BITMASK_WAKE_STATUS)
+
+#define ACPI_BITMASK_TIMER_ENABLE               0x0001
+#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
+#define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
+#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
+#define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
+
+#define ACPI_BITMASK_SCI_ENABLE                 0x0001
+#define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
+#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
+#define ACPI_BITMASK_SLEEP_TYPE_X               0x1C00
+#define ACPI_BITMASK_SLEEP_ENABLE               0x2000
+
+#define ACPI_BITMASK_ARB_DISABLE                0x0001
+
+
+/* Raw bit position of each bit_register */
+
+#define ACPI_BITPOSITION_TIMER_STATUS           0x00
+#define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
+#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
+#define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
+#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
+#define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
+#define ACPI_BITPOSITION_WAKE_STATUS            0x0F
+
+#define ACPI_BITPOSITION_TIMER_ENABLE           0x00
+#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
+#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
+#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
+#define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
+
+#define ACPI_BITPOSITION_SCI_ENABLE             0x00
+#define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
+#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
+#define ACPI_BITPOSITION_SLEEP_TYPE_X           0x0A
+#define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
+
+#define ACPI_BITPOSITION_ARB_DISABLE            0x00
+
+
+/*****************************************************************************
+ *
+ * Resource descriptors
+ *
+ ****************************************************************************/
+
+
+/* resource_type values */
+
+#define ACPI_RESOURCE_TYPE_MEMORY_RANGE         0
+#define ACPI_RESOURCE_TYPE_IO_RANGE             1
+#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE     2
+
+/* Resource descriptor types and masks */
+
+#define ACPI_RDESC_TYPE_LARGE                   0x80
+#define ACPI_RDESC_TYPE_SMALL                   0x00
+
+#define ACPI_RDESC_TYPE_MASK                    0x80
+#define ACPI_RDESC_SMALL_MASK                   0x78 /* Only bits 6:3 contain the type */
+
+
+/*
+ * Small resource descriptor types
+ * Note: The 3 length bits (2:0) must be zero
+ */
+#define ACPI_RDESC_TYPE_IRQ_FORMAT              0x20
+#define ACPI_RDESC_TYPE_DMA_FORMAT              0x28
+#define ACPI_RDESC_TYPE_START_DEPENDENT         0x30
+#define ACPI_RDESC_TYPE_END_DEPENDENT           0x38
+#define ACPI_RDESC_TYPE_IO_PORT                 0x40
+#define ACPI_RDESC_TYPE_FIXED_IO_PORT           0x48
+#define ACPI_RDESC_TYPE_SMALL_VENDOR            0x70
+#define ACPI_RDESC_TYPE_END_TAG                 0x78
+
+/*
+ * Large resource descriptor types
+ */
+
+#define ACPI_RDESC_TYPE_MEMORY_24               0x81
+#define ACPI_RDESC_TYPE_GENERAL_REGISTER        0x82
+#define ACPI_RDESC_TYPE_LARGE_VENDOR            0x84
+#define ACPI_RDESC_TYPE_MEMORY_32               0x85
+#define ACPI_RDESC_TYPE_FIXED_MEMORY_32         0x86
+#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE     0x87
+#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE      0x88
+#define ACPI_RDESC_TYPE_EXTENDED_XRUPT          0x89
+#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE     0x8A
+
+
+/*****************************************************************************
+ *
+ * Miscellaneous
+ *
+ ****************************************************************************/
+
+#define ACPI_ASCII_ZERO                      0x30
+
+
+/*****************************************************************************
+ *
+ * Debugger
+ *
+ ****************************************************************************/
+
+struct acpi_db_method_info
+{
+       acpi_handle                     thread_gate;
+       char                            *name;
+       char                            **args;
+       u32                             flags;
+       u32                             num_loops;
+       char                            pathname[128];
+};
+
+struct acpi_integrity_info
+{
+       u32                         nodes;
+       u32                         objects;
+};
+
+
+#define ACPI_DB_REDIRECTABLE_OUTPUT  0x01
+#define ACPI_DB_CONSOLE_OUTPUT       0x02
+#define ACPI_DB_DUPLICATE_OUTPUT     0x03
+
+
+/*****************************************************************************
+ *
+ * Debug
+ *
+ ****************************************************************************/
+
+struct acpi_debug_print_info
+{
+       u32                             component_id;
+       char                            *proc_name;
+       char                            *module_name;
+};
+
+
+/* Entry for a memory allocation (debug only) */
+
+#define ACPI_MEM_MALLOC                      0
+#define ACPI_MEM_CALLOC                      1
+#define ACPI_MAX_MODULE_NAME                 16
+
+#define ACPI_COMMON_DEBUG_MEM_HEADER \
+       struct acpi_debug_mem_block         *previous; \
+       struct acpi_debug_mem_block         *next; \
+       u32                                 size; \
+       u32                                 component; \
+       u32                                 line; \
+       char                                module[ACPI_MAX_MODULE_NAME]; \
+       u8                                  alloc_type;
+
+struct acpi_debug_mem_header
+{
+       ACPI_COMMON_DEBUG_MEM_HEADER
+};
+
+struct acpi_debug_mem_block
+{
+       ACPI_COMMON_DEBUG_MEM_HEADER
+       u64                                 user_space;
+};
+
+
+#define ACPI_MEM_LIST_GLOBAL            0
+#define ACPI_MEM_LIST_NSNODE            1
+
+#define ACPI_MEM_LIST_FIRST_CACHE_LIST  2
+#define ACPI_MEM_LIST_STATE             2
+#define ACPI_MEM_LIST_PSNODE            3
+#define ACPI_MEM_LIST_PSNODE_EXT        4
+#define ACPI_MEM_LIST_OPERAND           5
+#define ACPI_MEM_LIST_WALK              6
+#define ACPI_MEM_LIST_MAX               6
+#define ACPI_NUM_MEM_LISTS              7
+
+
+struct acpi_memory_list
+{
+       void                                *list_head;
+       u16                                 link_offset;
+       u16                                 max_cache_depth;
+       u16                                 cache_depth;
+       u16                                 object_size;
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+       /* Statistics for debug memory tracking only */
+
+       u32                                 total_allocated;
+       u32                                 total_freed;
+       u32                                 current_total_size;
+       u32                                 cache_requests;
+       u32                                 cache_hits;
+       char                                *list_name;
+#endif
+};
+
+
+#endif /* __ACLOCAL_H__ */
diff --git a/xen/include/acpi/acmacros.h b/xen/include/acpi/acmacros.h
new file mode 100644 (file)
index 0000000..e1abf96
--- /dev/null
@@ -0,0 +1,687 @@
+/******************************************************************************
+ *
+ * Name: acmacros.h - C macros for the entire subsystem.
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACMACROS_H__
+#define __ACMACROS_H__
+
+
+/*
+ * Data manipulation macros
+ */
+#define ACPI_LOWORD(l)                  ((u16)(u32)(l))
+#define ACPI_HIWORD(l)                  ((u16)((((u32)(l)) >> 16) & 0xFFFF))
+#define ACPI_LOBYTE(l)                  ((u8)(u16)(l))
+#define ACPI_HIBYTE(l)                  ((u8)((((u16)(l)) >> 8) & 0xFF))
+
+
+#if ACPI_MACHINE_WIDTH == 16
+
+/*
+ * For 16-bit addresses, we have to assume that the upper 32 bits
+ * are zero.
+ */
+#define ACPI_LODWORD(l)                 ((u32)(l))
+#define ACPI_HIDWORD(l)                 ((u32)(0))
+
+#define ACPI_GET_ADDRESS(a)             ((a).lo)
+#define ACPI_STORE_ADDRESS(a,b)         {(a).hi=0;(a).lo=(u32)(b);}
+#define ACPI_VALID_ADDRESS(a)           ((a).hi | (a).lo)
+
+#else
+#ifdef ACPI_NO_INTEGER64_SUPPORT
+/*
+ * acpi_integer is 32-bits, no 64-bit support on this platform
+ */
+#define ACPI_LODWORD(l)                 ((u32)(l))
+#define ACPI_HIDWORD(l)                 ((u32)(0))
+
+#define ACPI_GET_ADDRESS(a)             (a)
+#define ACPI_STORE_ADDRESS(a,b)         ((a)=(b))
+#define ACPI_VALID_ADDRESS(a)           (a)
+
+#else
+
+/*
+ * Full 64-bit address/integer on both 32-bit and 64-bit platforms
+ */
+#define ACPI_LODWORD(l)                 ((u32)(u64)(l))
+#define ACPI_HIDWORD(l)                 ((u32)(((*(struct uint64_struct *)(void *)(&l))).hi))
+
+#define ACPI_GET_ADDRESS(a)             (a)
+#define ACPI_STORE_ADDRESS(a,b)         ((a)=(acpi_physical_address)(b))
+#define ACPI_VALID_ADDRESS(a)           (a)
+#endif
+#endif
+
+/*
+ * printf() format helpers
+ */
+
+/* Split 64-bit integer into two 32-bit values. use with %8,8_x%8.8X */
+
+#define ACPI_FORMAT_UINT64(i)           ACPI_HIDWORD(i),ACPI_LODWORD(i)
+
+/*
+ * Extract a byte of data using a pointer.  Any more than a byte and we
+ * get into potential aligment issues -- see the STORE macros below
+ */
+#define ACPI_GET8(addr)                 (*(u8*)(addr))
+
+/* Pointer arithmetic */
+
+#define ACPI_PTR_ADD(t,a,b)             (t *) (void *)((char *)(a) + (acpi_native_uint)(b))
+#define ACPI_PTR_DIFF(a,b)              (acpi_native_uint) ((char *)(a) - (char *)(b))
+
+/* Pointer/Integer type conversions */
+
+#define ACPI_TO_POINTER(i)              ACPI_PTR_ADD (void, (void *) NULL,(acpi_native_uint)i)
+#define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p,(void *) NULL)
+#define ACPI_OFFSET(d,f)                (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
+#define ACPI_FADT_OFFSET(f)             ACPI_OFFSET (FADT_DESCRIPTOR, f)
+
+#define ACPI_CAST_PTR(t, p)             ((t *)(void *)(p))
+#define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **)(void *)(p))
+
+#if ACPI_MACHINE_WIDTH == 16
+#define ACPI_STORE_POINTER(d,s)         ACPI_MOVE_32_TO_32(d,s)
+#define ACPI_PHYSADDR_TO_PTR(i)         (void *)(i)
+#define ACPI_PTR_TO_PHYSADDR(i)         (u32) (char *)(i)
+#else
+#define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
+#define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
+#endif
+
+/*
+ * Macros for moving data around to/from buffers that are possibly unaligned.
+ * If the hardware supports the transfer of unaligned data, just do the store.
+ * Otherwise, we have to move one byte at a time.
+ */
+#ifdef ACPI_BIG_ENDIAN
+/*
+ * Macros for big-endian machines
+ */
+
+/* This macro sets a buffer index, starting from the end of the buffer */
+
+#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) ((buf_len) - (((buf_offset)+1) * (byte_gran)))
+
+/* These macros reverse the bytes during the move, converting little-endian to big endian */
+
+        /* Big Endian      <==        Little Endian */
+        /*  Hi...Lo                     Lo...Hi     */
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
+                         ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
+
+#define ACPI_MOVE_16_TO_32(d,s)         {(*(u32 *)(void *)(d))=0;\
+                                         ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
+                                         ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
+
+#define ACPI_MOVE_16_TO_64(d,s)         {(*(u64 *)(void *)(d))=0;\
+                                                          ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
+                                                          ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+
+#define ACPI_MOVE_32_TO_32(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
+                                                                         ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
+                                                                         ((  u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
+                                                                         ((  u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
+
+#define ACPI_MOVE_32_TO_64(d,s)         {(*(u64 *)(void *)(d))=0;\
+                                                                                  ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
+                                                                                  ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
+                                                                                  ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
+                                                                                  ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+
+#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)    /* Truncate to 32 */
+
+#define ACPI_MOVE_64_TO_64(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
+                                                                                ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\
+                                                                                ((  u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\
+                                                                                ((  u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\
+                                                                                ((  u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
+                                                                                ((  u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
+                                                                                ((  u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
+                                                                                ((  u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
+#else
+/*
+ * Macros for little-endian machines
+ */
+
+/* This macro sets a buffer index, starting from the beginning of the buffer */
+
+#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset)
+
+#ifdef ACPI_MISALIGNED_TRANSFERS
+
+/* The hardware supports unaligned transfers, just do the little-endian move */
+
+#if ACPI_MACHINE_WIDTH == 16
+
+/* No 64-bit integers */
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s)         *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_32(d,s)         *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_64(d,s)         ACPI_MOVE_16_TO_32(d,s)
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_32(d,s)         *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
+#define ACPI_MOVE_32_TO_64(d,s)         ACPI_MOVE_32_TO_32(d,s)
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)    /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d,s)         ACPI_MOVE_32_TO_32(d,s)
+
+#else
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s)         *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_32(d,s)         *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_64(d,s)         *(u64 *)(void *)(d) = *(u16 *)(void *)(s)
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_32(d,s)         *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
+#define ACPI_MOVE_32_TO_64(d,s)         *(u64 *)(void *)(d) = *(u32 *)(void *)(s)
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)    /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d,s)         *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
+#endif
+
+#else
+/*
+ * The hardware does not support unaligned transfers.  We must move the
+ * data one byte at a time.  These macros work whether the source or
+ * the destination (or both) is/are unaligned.  (Little-endian move)
+ */
+
+/* 16-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_16_TO_16(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
+                                                                                ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];}
+
+#define ACPI_MOVE_16_TO_32(d,s)         {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
+#define ACPI_MOVE_16_TO_64(d,s)         {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
+
+/* 32-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+
+#define ACPI_MOVE_32_TO_32(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
+                                                                                ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
+                                                                                ((  u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
+                                                                                ((  u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];}
+
+#define ACPI_MOVE_32_TO_64(d,s)         {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);}
+
+/* 64-bit source, 16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)    /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
+                                                                                ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
+                                                                                ((  u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
+                                                                                ((  u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\
+                                                                                ((  u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\
+                                                                                ((  u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\
+                                                                                ((  u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\
+                                                                                ((  u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];}
+#endif
+#endif
+
+/* Macros based on machine integer width */
+
+#if ACPI_MACHINE_WIDTH == 16
+#define ACPI_MOVE_SIZE_TO_16(d,s)       ACPI_MOVE_16_TO_16(d,s)
+
+#elif ACPI_MACHINE_WIDTH == 32
+#define ACPI_MOVE_SIZE_TO_16(d,s)       ACPI_MOVE_32_TO_16(d,s)
+
+#elif ACPI_MACHINE_WIDTH == 64
+#define ACPI_MOVE_SIZE_TO_16(d,s)       ACPI_MOVE_64_TO_16(d,s)
+
+#else
+#error unknown ACPI_MACHINE_WIDTH
+#endif
+
+
+/*
+ * Fast power-of-two math macros for non-optimized compilers
+ */
+#define _ACPI_DIV(value,power_of2)      ((u32) ((value) >> (power_of2)))
+#define _ACPI_MUL(value,power_of2)      ((u32) ((value) << (power_of2)))
+#define _ACPI_MOD(value,divisor)        ((u32) ((value) & ((divisor) -1)))
+
+#define ACPI_DIV_2(a)                   _ACPI_DIV(a,1)
+#define ACPI_MUL_2(a)                   _ACPI_MUL(a,1)
+#define ACPI_MOD_2(a)                   _ACPI_MOD(a,2)
+
+#define ACPI_DIV_4(a)                   _ACPI_DIV(a,2)
+#define ACPI_MUL_4(a)                   _ACPI_MUL(a,2)
+#define ACPI_MOD_4(a)                   _ACPI_MOD(a,4)
+
+#define ACPI_DIV_8(a)                   _ACPI_DIV(a,3)
+#define ACPI_MUL_8(a)                   _ACPI_MUL(a,3)
+#define ACPI_MOD_8(a)                   _ACPI_MOD(a,8)
+
+#define ACPI_DIV_16(a)                  _ACPI_DIV(a,4)
+#define ACPI_MUL_16(a)                  _ACPI_MUL(a,4)
+#define ACPI_MOD_16(a)                  _ACPI_MOD(a,16)
+
+
+/*
+ * Rounding macros (Power of two boundaries only)
+ */
+#define ACPI_ROUND_DOWN(value,boundary)      (((acpi_native_uint)(value)) & (~(((acpi_native_uint) boundary)-1)))
+#define ACPI_ROUND_UP(value,boundary)        ((((acpi_native_uint)(value)) + (((acpi_native_uint) boundary)-1)) & (~(((acpi_native_uint) boundary)-1)))
+
+#define ACPI_ROUND_DOWN_TO_32_BITS(a)        ACPI_ROUND_DOWN(a,4)
+#define ACPI_ROUND_DOWN_TO_64_BITS(a)        ACPI_ROUND_DOWN(a,8)
+#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a)    ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
+
+#define ACPI_ROUND_UP_to_32_bITS(a)          ACPI_ROUND_UP(a,4)
+#define ACPI_ROUND_UP_to_64_bITS(a)          ACPI_ROUND_UP(a,8)
+#define ACPI_ROUND_UP_TO_NATIVE_WORD(a)      ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
+
+
+#define ACPI_ROUND_BITS_UP_TO_BYTES(a)       ACPI_DIV_8((a) + 7)
+#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a)     ACPI_DIV_8((a))
+
+#define ACPI_ROUND_UP_TO_1K(a)               (((a) + 1023) >> 10)
+
+/* Generic (non-power-of-two) rounding */
+
+#define ACPI_ROUND_UP_TO(value,boundary)     (((value) + ((boundary)-1)) / (boundary))
+
+/*
+ * Bitmask creation
+ * Bit positions start at zero.
+ * MASK_BITS_ABOVE creates a mask starting AT the position and above
+ * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
+ */
+#define ACPI_MASK_BITS_ABOVE(position)       (~((ACPI_INTEGER_MAX) << ((u32) (position))))
+#define ACPI_MASK_BITS_BELOW(position)       ((ACPI_INTEGER_MAX) << ((u32) (position)))
+
+#define ACPI_IS_OCTAL_DIGIT(d)               (((char)(d) >= '0') && ((char)(d) <= '7'))
+
+/* Macros for GAS addressing */
+
+#if ACPI_MACHINE_WIDTH != 16
+
+#define ACPI_PCI_DEVICE(a)              (u16) ((ACPI_HIDWORD ((a))) & 0x0000FFFF)
+#define ACPI_PCI_FUNCTION(a)            (u16) ((ACPI_LODWORD ((a))) >> 16)
+#define ACPI_PCI_REGISTER(a)            (u16) ((ACPI_LODWORD ((a))) & 0x0000FFFF)
+
+#else
+
+/* No support for GAS and PCI IDs in 16-bit mode  */
+
+#define ACPI_PCI_FUNCTION(a)            (u16) ((a) & 0xFFFF0000)
+#define ACPI_PCI_DEVICE(a)              (u16) ((a) & 0x0000FFFF)
+#define ACPI_PCI_REGISTER(a)            (u16) ((a) & 0x0000FFFF)
+
+#endif
+
+
+/* Bitfields within ACPI registers */
+
+#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask)      ((val << pos) & mask)
+#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val)  reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask)
+
+/*
+ * An struct acpi_namespace_node * can appear in some contexts,
+ * where a pointer to an union acpi_operand_object    can also
+ * appear.  This macro is used to distinguish them.
+ *
+ * The "Descriptor" field is the first field in both structures.
+ */
+#define ACPI_GET_DESCRIPTOR_TYPE(d)     (((union acpi_descriptor *)(void *)(d))->descriptor_id)
+#define ACPI_SET_DESCRIPTOR_TYPE(d,t)   (((union acpi_descriptor *)(void *)(d))->descriptor_id = t)
+
+
+/* Macro to test the object type */
+
+#define ACPI_GET_OBJECT_TYPE(d)         (((union acpi_operand_object *)(void *)(d))->common.type)
+
+/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
+
+#define ACPI_IS_SINGLE_TABLE(x)         (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
+
+/*
+ * Macros for the master AML opcode table
+ */
+#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
+#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags)    {name,(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type}
+#else
+#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags)    {(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type}
+#endif
+
+#ifdef ACPI_DISASSEMBLER
+#define ACPI_DISASM_ONLY_MEMBERS(a)     a;
+#else
+#define ACPI_DISASM_ONLY_MEMBERS(a)
+#endif
+
+#define ARG_TYPE_WIDTH                  5
+#define ARG_1(x)                        ((u32)(x))
+#define ARG_2(x)                        ((u32)(x) << (1 * ARG_TYPE_WIDTH))
+#define ARG_3(x)                        ((u32)(x) << (2 * ARG_TYPE_WIDTH))
+#define ARG_4(x)                        ((u32)(x) << (3 * ARG_TYPE_WIDTH))
+#define ARG_5(x)                        ((u32)(x) << (4 * ARG_TYPE_WIDTH))
+#define ARG_6(x)                        ((u32)(x) << (5 * ARG_TYPE_WIDTH))
+
+#define ARGI_LIST1(a)                   (ARG_1(a))
+#define ARGI_LIST2(a,b)                 (ARG_1(b)|ARG_2(a))
+#define ARGI_LIST3(a,b,c)               (ARG_1(c)|ARG_2(b)|ARG_3(a))
+#define ARGI_LIST4(a,b,c,d)             (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
+#define ARGI_LIST5(a,b,c,d,e)           (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
+#define ARGI_LIST6(a,b,c,d,e,f)         (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))
+
+#define ARGP_LIST1(a)                   (ARG_1(a))
+#define ARGP_LIST2(a,b)                 (ARG_1(a)|ARG_2(b))
+#define ARGP_LIST3(a,b,c)               (ARG_1(a)|ARG_2(b)|ARG_3(c))
+#define ARGP_LIST4(a,b,c,d)             (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
+#define ARGP_LIST5(a,b,c,d,e)           (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
+#define ARGP_LIST6(a,b,c,d,e,f)         (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
+
+#define GET_CURRENT_ARG_TYPE(list)      (list & ((u32) 0x1F))
+#define INCREMENT_ARG_LIST(list)        (list >>= ((u32) ARG_TYPE_WIDTH))
+
+
+/*
+ * Reporting macros that are never compiled out
+ */
+#define ACPI_PARAM_LIST(pl)                 pl
+
+/*
+ * Error reporting.  These versions add callers module and line#.  Since
+ * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only
+ * use it in debug mode.
+ */
+#ifdef ACPI_DEBUG_OUTPUT
+
+#define ACPI_REPORT_INFO(fp)                {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
+                                                                                               acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_ERROR(fp)               {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
+                                                                                               acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_WARNING(fp)             {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
+                                                                                               acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_NSERROR(s,e)            acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e);
+
+#define ACPI_REPORT_METHOD_ERROR(s,n,p,e)   acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e);
+
+#else
+
+#define ACPI_REPORT_INFO(fp)                {acpi_ut_report_info("ACPI",__LINE__,_COMPONENT); \
+                                                                                               acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_ERROR(fp)               {acpi_ut_report_error("ACPI",__LINE__,_COMPONENT); \
+                                                                                               acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_WARNING(fp)             {acpi_ut_report_warning("ACPI",__LINE__,_COMPONENT); \
+                                                                                               acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define ACPI_REPORT_NSERROR(s,e)            acpi_ns_report_error("ACPI",__LINE__,_COMPONENT, s, e);
+
+#define ACPI_REPORT_METHOD_ERROR(s,n,p,e)   acpi_ns_report_method_error("ACPI",__LINE__,_COMPONENT, s, n, p, e);
+
+#endif
+
+/* Error reporting.  These versions pass thru the module and line# */
+
+#define _ACPI_REPORT_INFO(a,b,c,fp)         {acpi_ut_report_info(a,b,c); \
+                                                                                               acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define _ACPI_REPORT_ERROR(a,b,c,fp)        {acpi_ut_report_error(a,b,c); \
+                                                                                               acpi_os_printf ACPI_PARAM_LIST(fp);}
+#define _ACPI_REPORT_WARNING(a,b,c,fp)      {acpi_ut_report_warning(a,b,c); \
+                                                                                               acpi_os_printf ACPI_PARAM_LIST(fp);}
+
+/*
+ * Debug macros that are conditionally compiled
+ */
+#ifdef ACPI_DEBUG_OUTPUT
+
+#define ACPI_MODULE_NAME(name)               static char ACPI_UNUSED_VAR *_THIS_MODULE = name;
+
+/*
+ * Function entry tracing.
+ * The first parameter should be the procedure name as a quoted string.  This is declared
+ * as a local string ("_proc_name) so that it can be also used by the function exit macros below.
+ */
+#define ACPI_FUNCTION_NAME(a)               struct acpi_debug_print_info _dbg; \
+                                                                                               _dbg.component_id = _COMPONENT; \
+                                                                                               _dbg.proc_name   = a; \
+                                                                                               _dbg.module_name = _THIS_MODULE;
+
+#define ACPI_FUNCTION_TRACE(a)              ACPI_FUNCTION_NAME(a) \
+                                                                                               acpi_ut_trace(__LINE__,&_dbg)
+#define ACPI_FUNCTION_TRACE_PTR(a,b)        ACPI_FUNCTION_NAME(a) \
+                                                                                               acpi_ut_trace_ptr(__LINE__,&_dbg,(void *)b)
+#define ACPI_FUNCTION_TRACE_U32(a,b)        ACPI_FUNCTION_NAME(a) \
+                                                                                               acpi_ut_trace_u32(__LINE__,&_dbg,(u32)b)
+#define ACPI_FUNCTION_TRACE_STR(a,b)        ACPI_FUNCTION_NAME(a) \
+                                                                                               acpi_ut_trace_str(__LINE__,&_dbg,(char *)b)
+
+#define ACPI_FUNCTION_ENTRY()               acpi_ut_track_stack_ptr()
+
+/*
+ * Function exit tracing.
+ * WARNING: These macros include a return statement.  This is usually considered
+ * bad form, but having a separate exit macro is very ugly and difficult to maintain.
+ * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
+ * so that "_proc_name" is defined.
+ */
+#ifdef ACPI_USE_DO_WHILE_0
+#define ACPI_DO_WHILE0(a)               do a while(0)
+#else
+#define ACPI_DO_WHILE0(a)               a
+#endif
+
+#define return_VOID                     ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_dbg);return;})
+#define return_ACPI_STATUS(s)           ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_dbg,(s));return((s));})
+#define return_VALUE(s)                 ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_dbg,(acpi_integer)(s));return((s));})
+#define return_PTR(s)                   ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_dbg,(u8 *)(s));return((s));})
+
+/* Conditional execution */
+
+#define ACPI_DEBUG_EXEC(a)              a
+#define ACPI_NORMAL_EXEC(a)
+
+#define ACPI_DEBUG_DEFINE(a)            a;
+#define ACPI_DEBUG_ONLY_MEMBERS(a)      a;
+#define _VERBOSE_STRUCTURES
+
+
+/* Stack and buffer dumping */
+
+#define ACPI_DUMP_STACK_ENTRY(a)        acpi_ex_dump_operand(a)
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e)   acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__)
+
+
+#define ACPI_DUMP_ENTRY(a,b)            acpi_ns_dump_entry (a,b)
+#define ACPI_DUMP_TABLES(a,b)           acpi_ns_dump_tables(a,b)
+#define ACPI_DUMP_PATHNAME(a,b,c,d)     acpi_ns_dump_pathname(a,b,c,d)
+#define ACPI_DUMP_RESOURCE_LIST(a)      acpi_rs_dump_resource_list(a)
+#define ACPI_DUMP_BUFFER(a,b)           acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
+#define ACPI_BREAK_MSG(a)               acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a))
+
+
+/*
+ * Generate INT3 on ACPI_ERROR (Debug only!)
+ */
+#define ACPI_ERROR_BREAK
+#ifdef  ACPI_ERROR_BREAK
+#define ACPI_BREAK_ON_ERROR(lvl)        if ((lvl)&ACPI_ERROR) \
+                                                                                       acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
+#else
+#define ACPI_BREAK_ON_ERROR(lvl)
+#endif
+
+/*
+ * Master debug print macros
+ * Print iff:
+ *    1) Debug print for the current component is enabled
+ *    2) Debug error level or trace level for the print statement is enabled
+ */
+#define ACPI_DEBUG_PRINT(pl)            acpi_ut_debug_print ACPI_PARAM_LIST(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl)        acpi_ut_debug_print_raw ACPI_PARAM_LIST(pl)
+
+
+#else
+/*
+ * This is the non-debug case -- make everything go away,
+ * leaving no executable debug code!
+ */
+#define ACPI_MODULE_NAME(name)
+#define _THIS_MODULE ""
+
+#define ACPI_DEBUG_EXEC(a)
+#define ACPI_NORMAL_EXEC(a)             a;
+
+#define ACPI_DEBUG_DEFINE(a)
+#define ACPI_DEBUG_ONLY_MEMBERS(a)
+#define ACPI_FUNCTION_NAME(a)
+#define ACPI_FUNCTION_TRACE(a)
+#define ACPI_FUNCTION_TRACE_PTR(a,b)
+#define ACPI_FUNCTION_TRACE_U32(a,b)
+#define ACPI_FUNCTION_TRACE_STR(a,b)
+#define ACPI_FUNCTION_EXIT
+#define ACPI_FUNCTION_STATUS_EXIT(s)
+#define ACPI_FUNCTION_VALUE_EXIT(s)
+#define ACPI_FUNCTION_ENTRY()
+#define ACPI_DUMP_STACK_ENTRY(a)
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e)
+#define ACPI_DUMP_ENTRY(a,b)
+#define ACPI_DUMP_TABLES(a,b)
+#define ACPI_DUMP_PATHNAME(a,b,c,d)
+#define ACPI_DUMP_RESOURCE_LIST(a)
+#define ACPI_DUMP_BUFFER(a,b)
+#define ACPI_DEBUG_PRINT(pl)
+#define ACPI_DEBUG_PRINT_RAW(pl)
+#define ACPI_BREAK_MSG(a)
+
+#define return_VOID                     return
+#define return_ACPI_STATUS(s)           return(s)
+#define return_VALUE(s)                 return(s)
+#define return_PTR(s)                   return(s)
+
+#endif
+
+/*
+ * Some code only gets executed when the debugger is built in.
+ * Note that this is entirely independent of whether the
+ * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not.
+ */
+#ifdef ACPI_DEBUGGER
+#define ACPI_DEBUGGER_EXEC(a)           a
+#else
+#define ACPI_DEBUGGER_EXEC(a)
+#endif
+
+
+/*
+ * For 16-bit code, we want to shrink some things even though
+ * we are using ACPI_DEBUG_OUTPUT to get the debug output
+ */
+#if ACPI_MACHINE_WIDTH == 16
+#undef ACPI_DEBUG_ONLY_MEMBERS
+#undef _VERBOSE_STRUCTURES
+#define ACPI_DEBUG_ONLY_MEMBERS(a)
+#endif
+
+
+#ifdef ACPI_DEBUG_OUTPUT
+/*
+ * 1) Set name to blanks
+ * 2) Copy the object name
+ */
+#define ACPI_ADD_OBJECT_NAME(a,b)       ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\
+                                                                               ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
+#else
+
+#define ACPI_ADD_OBJECT_NAME(a,b)
+#endif
+
+
+/*
+ * Memory allocation tracking (DEBUG ONLY)
+ */
+#ifndef ACPI_DBG_TRACK_ALLOCATIONS
+
+/* Memory allocation */
+
+#define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_FREE(a)                acpi_os_free(a)
+#define ACPI_MEM_TRACKING(a)
+
+
+#else
+
+/* Memory allocation */
+
+#define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_FREE(a)                acpi_ut_free_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_TRACKING(a)            a
+
+#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
+
+
+#define ACPI_GET_STACK_POINTER          _asm {mov eax, ebx}
+
+#endif /* ACMACROS_H */
diff --git a/xen/include/acpi/acnamesp.h b/xen/include/acpi/acnamesp.h
new file mode 100644 (file)
index 0000000..de54ba7
--- /dev/null
@@ -0,0 +1,513 @@
+/******************************************************************************
+ *
+ * Name: acnamesp.h - Namespace subcomponent prototypes and defines
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACNAMESP_H__
+#define __ACNAMESP_H__
+
+
+/* To search the entire name space, pass this as search_base */
+
+#define ACPI_NS_ALL                 ((acpi_handle)0)
+
+/*
+ * Elements of acpi_ns_properties are bit significant
+ * and should be one-to-one with values of acpi_object_type
+ */
+#define ACPI_NS_NORMAL              0
+#define ACPI_NS_NEWSCOPE            1   /* a definition of this type opens a name scope */
+#define ACPI_NS_LOCAL               2   /* suppress search of enclosing scopes */
+
+
+/* Definitions of the predefined namespace names  */
+
+#define ACPI_UNKNOWN_NAME           (u32) 0x3F3F3F3F     /* Unknown name is  "????" */
+#define ACPI_ROOT_NAME              (u32) 0x5F5F5F5C     /* Root name is     "\___" */
+#define ACPI_SYS_BUS_NAME           (u32) 0x5F53425F     /* Sys bus name is  "_SB_" */
+
+#define ACPI_NS_ROOT_PATH           "\\"
+#define ACPI_NS_SYSTEM_BUS          "_SB_"
+
+
+/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
+
+#define ACPI_NS_NO_UPSEARCH         0
+#define ACPI_NS_SEARCH_PARENT       0x01
+#define ACPI_NS_DONT_OPEN_SCOPE     0x02
+#define ACPI_NS_NO_PEER_SEARCH      0x04
+#define ACPI_NS_ERROR_IF_FOUND      0x08
+
+#define ACPI_NS_WALK_UNLOCK         TRUE
+#define ACPI_NS_WALK_NO_UNLOCK      FALSE
+
+
+acpi_status
+acpi_ns_load_namespace (
+       void);
+
+acpi_status
+acpi_ns_initialize_objects (
+       void);
+
+acpi_status
+acpi_ns_initialize_devices (
+       void);
+
+
+/* Namespace init - nsxfinit */
+
+acpi_status
+acpi_ns_init_one_device (
+       acpi_handle                     obj_handle,
+       u32                             nesting_level,
+       void                            *context,
+       void                            **return_value);
+
+acpi_status
+acpi_ns_init_one_object (
+       acpi_handle                     obj_handle,
+       u32                             level,
+       void                            *context,
+       void                            **return_value);
+
+
+acpi_status
+acpi_ns_walk_namespace (
+       acpi_object_type                type,
+       acpi_handle                     start_object,
+       u32                             max_depth,
+       u8                              unlock_before_callback,
+       acpi_walk_callback              user_function,
+       void                            *context,
+       void                            **return_value);
+
+struct acpi_namespace_node *
+acpi_ns_get_next_node (
+       acpi_object_type                type,
+       struct acpi_namespace_node      *parent,
+       struct acpi_namespace_node      *child);
+
+void
+acpi_ns_delete_namespace_by_owner (
+       u16                             table_id);
+
+
+/* Namespace loading - nsload */
+
+acpi_status
+acpi_ns_one_complete_parse (
+       u32                             pass_number,
+       struct acpi_table_desc          *table_desc);
+
+acpi_status
+acpi_ns_parse_table (
+       struct acpi_table_desc          *table_desc,
+       struct acpi_namespace_node      *scope);
+
+acpi_status
+acpi_ns_load_table (
+       struct acpi_table_desc          *table_desc,
+       struct acpi_namespace_node      *node);
+
+acpi_status
+acpi_ns_load_table_by_type (
+       acpi_table_type                 table_type);
+
+
+/*
+ * Top-level namespace access - nsaccess
+ */
+
+acpi_status
+acpi_ns_root_initialize (
+       void);
+
+acpi_status
+acpi_ns_lookup (
+       union acpi_generic_state        *scope_info,
+       char                            *name,
+       acpi_object_type                type,
+       acpi_interpreter_mode           interpreter_mode,
+       u32                             flags,
+       struct acpi_walk_state          *walk_state,
+       struct acpi_namespace_node      **ret_node);
+
+
+/*
+ * Named object allocation/deallocation - nsalloc
+ */
+
+struct acpi_namespace_node *
+acpi_ns_create_node (
+       u32                             name);
+
+void
+acpi_ns_delete_node (
+       struct acpi_namespace_node      *node);
+
+void
+acpi_ns_delete_namespace_subtree (
+       struct acpi_namespace_node      *parent_handle);
+
+void
+acpi_ns_detach_object (
+       struct acpi_namespace_node      *node);
+
+void
+acpi_ns_delete_children (
+       struct acpi_namespace_node      *parent);
+
+int
+acpi_ns_compare_names (
+       char                            *name1,
+       char                            *name2);
+
+void
+acpi_ns_remove_reference (
+       struct acpi_namespace_node      *node);
+
+
+/*
+ * Namespace modification - nsmodify
+ */
+
+acpi_status
+acpi_ns_unload_namespace (
+       acpi_handle                     handle);
+
+acpi_status
+acpi_ns_delete_subtree (
+       acpi_handle                     start_handle);
+
+
+/*
+ * Namespace dump/print utilities - nsdump
+ */
+
+void
+acpi_ns_dump_tables (
+       acpi_handle                     search_base,
+       u32                             max_depth);
+
+void
+acpi_ns_dump_entry (
+       acpi_handle                     handle,
+       u32                             debug_level);
+
+void
+acpi_ns_dump_pathname (
+       acpi_handle                     handle,
+       char                            *msg,
+       u32                             level,
+       u32                             component);
+
+void
+acpi_ns_print_pathname (
+       u32                             num_segments,
+       char                            *pathname);
+
+acpi_status
+acpi_ns_dump_one_device (
+       acpi_handle                     obj_handle,
+       u32                             level,
+       void                            *context,
+       void                            **return_value);
+
+void
+acpi_ns_dump_root_devices (
+       void);
+
+acpi_status
+acpi_ns_dump_one_object (
+       acpi_handle                     obj_handle,
+       u32                             level,
+       void                            *context,
+       void                            **return_value);
+
+void
+acpi_ns_dump_objects (
+       acpi_object_type                type,
+       u8                              display_type,
+       u32                             max_depth,
+       u32                             ownder_id,
+       acpi_handle                     start_handle);
+
+
+/*
+ * Namespace evaluation functions - nseval
+ */
+
+acpi_status
+acpi_ns_evaluate_by_handle (
+       struct acpi_namespace_node      *prefix_node,
+       union acpi_operand_object       **params,
+       union acpi_operand_object       **return_object);
+
+acpi_status
+acpi_ns_evaluate_by_name (
+       char                            *pathname,
+       union acpi_operand_object       **params,
+       union acpi_operand_object       **return_object);
+
+acpi_status
+acpi_ns_evaluate_relative (
+       struct acpi_namespace_node      *prefix_node,
+       char                            *pathname,
+       union acpi_operand_object       **params,
+       union acpi_operand_object       **return_object);
+
+acpi_status
+acpi_ns_execute_control_method (
+       struct acpi_namespace_node      *method_node,
+       union acpi_operand_object       **params,
+       union acpi_operand_object       **return_obj_desc);
+
+acpi_status
+acpi_ns_get_object_value (
+       struct acpi_namespace_node      *object_node,
+       union acpi_operand_object       **return_obj_desc);
+
+
+/*
+ * Parent/Child/Peer utility functions
+ */
+
+acpi_name
+acpi_ns_find_parent_name (
+       struct acpi_namespace_node      *node_to_search);
+
+
+/*
+ * Name and Scope manipulation - nsnames
+ */
+
+u32
+acpi_ns_opens_scope (
+       acpi_object_type                type);
+
+void
+acpi_ns_build_external_path (
+       struct acpi_namespace_node      *node,
+       acpi_size                       size,
+       char                            *name_buffer);
+
+char *
+acpi_ns_get_external_pathname (
+       struct acpi_namespace_node      *node);
+
+char *
+acpi_ns_name_of_current_scope (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ns_handle_to_pathname (
+       acpi_handle                     target_handle,
+       struct acpi_buffer              *buffer);
+
+u8
+acpi_ns_pattern_match (
+       struct acpi_namespace_node      *obj_node,
+       char                            *search_for);
+
+acpi_status
+acpi_ns_get_node_by_path (
+       char                            *external_pathname,
+       struct acpi_namespace_node      *in_prefix_node,
+       u32                             flags,
+       struct acpi_namespace_node      **out_node);
+
+acpi_size
+acpi_ns_get_pathname_length (
+       struct acpi_namespace_node      *node);
+
+
+/*
+ * Object management for namespace nodes - nsobject
+ */
+
+acpi_status
+acpi_ns_attach_object (
+       struct acpi_namespace_node      *node,
+       union acpi_operand_object       *object,
+       acpi_object_type                type);
+
+union acpi_operand_object *
+acpi_ns_get_attached_object (
+       struct acpi_namespace_node      *node);
+
+union acpi_operand_object *
+acpi_ns_get_secondary_object (
+       union acpi_operand_object       *obj_desc);
+
+acpi_status
+acpi_ns_attach_data (
+       struct acpi_namespace_node      *node,
+       acpi_object_handler             handler,
+       void                            *data);
+
+acpi_status
+acpi_ns_detach_data (
+       struct acpi_namespace_node      *node,
+       acpi_object_handler             handler);
+
+acpi_status
+acpi_ns_get_attached_data (
+       struct acpi_namespace_node      *node,
+       acpi_object_handler             handler,
+       void                            **data);
+
+
+/*
+ * Namespace searching and entry - nssearch
+ */
+
+acpi_status
+acpi_ns_search_and_enter (
+       u32                             entry_name,
+       struct acpi_walk_state          *walk_state,
+       struct acpi_namespace_node      *node,
+       acpi_interpreter_mode           interpreter_mode,
+       acpi_object_type                type,
+       u32                             flags,
+       struct acpi_namespace_node      **ret_node);
+
+acpi_status
+acpi_ns_search_node (
+       u32                             entry_name,
+       struct acpi_namespace_node      *node,
+       acpi_object_type                type,
+       struct acpi_namespace_node      **ret_node);
+
+void
+acpi_ns_install_node (
+       struct acpi_walk_state          *walk_state,
+       struct acpi_namespace_node      *parent_node,
+       struct acpi_namespace_node      *node,
+       acpi_object_type                type);
+
+
+/*
+ * Utility functions - nsutils
+ */
+
+u8
+acpi_ns_valid_root_prefix (
+       char                            prefix);
+
+u8
+acpi_ns_valid_path_separator (
+       char                            sep);
+
+acpi_object_type
+acpi_ns_get_type (
+       struct acpi_namespace_node      *node);
+
+u32
+acpi_ns_local (
+       acpi_object_type                type);
+
+void
+acpi_ns_report_error (
+       char                            *module_name,
+       u32                             line_number,
+       u32                             component_id,
+       char                            *internal_name,
+       acpi_status                     lookup_status);
+
+void
+acpi_ns_report_method_error (
+       char                            *module_name,
+       u32                             line_number,
+       u32                             component_id,
+       char                            *message,
+       struct acpi_namespace_node      *node,
+       char                            *path,
+       acpi_status                     lookup_status);
+
+void
+acpi_ns_print_node_pathname (
+       struct acpi_namespace_node      *node,
+       char                            *msg);
+
+acpi_status
+acpi_ns_build_internal_name (
+       struct acpi_namestring_info     *info);
+
+void
+acpi_ns_get_internal_name_length (
+       struct acpi_namestring_info     *info);
+
+acpi_status
+acpi_ns_internalize_name (
+       char                            *dotted_name,
+       char                            **converted_name);
+
+acpi_status
+acpi_ns_externalize_name (
+       u32                             internal_name_length,
+       char                            *internal_name,
+       u32                             *converted_name_length,
+       char                            **converted_name);
+
+struct acpi_namespace_node *
+acpi_ns_map_handle_to_node (
+       acpi_handle                     handle);
+
+acpi_handle
+acpi_ns_convert_entry_to_handle(
+       struct acpi_namespace_node      *node);
+
+void
+acpi_ns_terminate (
+       void);
+
+struct acpi_namespace_node *
+acpi_ns_get_parent_node (
+       struct acpi_namespace_node      *node);
+
+
+struct acpi_namespace_node *
+acpi_ns_get_next_valid_node (
+       struct acpi_namespace_node      *node);
+
+
+#endif /* __ACNAMESP_H__ */
diff --git a/xen/include/acpi/acobject.h b/xen/include/acpi/acobject.h
new file mode 100644 (file)
index 0000000..6caaf6a
--- /dev/null
@@ -0,0 +1,494 @@
+
+/******************************************************************************
+ *
+ * Name: acobject.h - Definition of union acpi_operand_object    (Internal object only)
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _ACOBJECT_H
+#define _ACOBJECT_H
+
+
+/*
+ * The union acpi_operand_object    is used to pass AML operands from the dispatcher
+ * to the interpreter, and to keep track of the various handlers such as
+ * address space handlers and notify handlers.  The object is a constant
+ * size in order to allow it to be cached and reused.
+ */
+
+/*******************************************************************************
+ *
+ * Common Descriptors
+ *
+ ******************************************************************************/
+
+/*
+ * Common area for all objects.
+ *
+ * data_type is used to differentiate between internal descriptors, and MUST
+ * be the first byte in this structure.
+ */
+#define ACPI_OBJECT_COMMON_HEADER   /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
+       u8                                      descriptor;         /* To differentiate various internal objs */\
+       u8                                      type;               /* acpi_object_type */\
+       u16                                     reference_count;    /* For object deletion management */\
+       union acpi_operand_object               *next_object;       /* Objects linked to parent NS node */\
+       u8                                      flags; \
+
+/* Values for flag byte above */
+
+#define AOPOBJ_AML_CONSTANT         0x01
+#define AOPOBJ_STATIC_POINTER       0x02
+#define AOPOBJ_DATA_VALID           0x04
+#define AOPOBJ_OBJECT_INITIALIZED   0x08
+#define AOPOBJ_SETUP_COMPLETE       0x10
+#define AOPOBJ_SINGLE_DATUM         0x20
+
+
+/*
+ * Common bitfield for the field objects
+ * "Field Datum"  -- a datum from the actual field object
+ * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
+ */
+#define ACPI_COMMON_FIELD_INFO      /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
+       u8                                      field_flags;        /* Access, update, and lock bits */\
+       u8                                      attribute;          /* From access_as keyword */\
+       u8                                      access_byte_width;  /* Read/Write size in bytes */\
+       u32                                     bit_length;         /* Length of field in bits */\
+       u32                                     base_byte_offset;   /* Byte offset within containing object */\
+       u8                                      start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
+       u8                                      datum_valid_bits;   /* Valid bit in first "Field datum" */\
+       u8                                      end_field_valid_bits; /* Valid bits in the last "field datum" */\
+       u8                                      end_buffer_valid_bits; /* Valid bits in the last "buffer datum" */\
+       u32                                     value;              /* Value to store into the Bank or Index register */\
+       struct acpi_namespace_node              *node;              /* Link back to parent node */
+
+
+/*
+ * Fields common to both Strings and Buffers
+ */
+#define ACPI_COMMON_BUFFER_INFO \
+       u32                                     length;
+
+
+/*
+ * Common fields for objects that support ASL notifications
+ */
+#define ACPI_COMMON_NOTIFY_INFO \
+       union acpi_operand_object               *system_notify;     /* Handler for system notifies */\
+       union acpi_operand_object               *device_notify;     /* Handler for driver notifies */\
+       union acpi_operand_object               *handler;           /* Handler for Address space */
+
+
+/******************************************************************************
+ *
+ * Basic data types
+ *
+ *****************************************************************************/
+
+struct acpi_object_common
+{
+       ACPI_OBJECT_COMMON_HEADER
+};
+
+
+struct acpi_object_integer
+{
+       ACPI_OBJECT_COMMON_HEADER
+       acpi_integer                            value;
+};
+
+
+struct acpi_object_string           /* Null terminated, ASCII characters only */
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_BUFFER_INFO
+       char                                    *pointer;           /* String in AML stream or allocated string */
+};
+
+
+struct acpi_object_buffer
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_BUFFER_INFO
+       u8                                      *pointer;           /* Buffer in AML stream or allocated buffer */
+       struct acpi_namespace_node              *node;              /* Link back to parent node */
+       u8                                      *aml_start;
+       u32                                     aml_length;
+};
+
+
+struct acpi_object_package
+{
+       ACPI_OBJECT_COMMON_HEADER
+
+       u32                                     count;              /* # of elements in package */
+       u32                                     aml_length;
+       u8                                      *aml_start;
+       struct acpi_namespace_node              *node;              /* Link back to parent node */
+       union acpi_operand_object               **elements;         /* Array of pointers to acpi_objects */
+};
+
+
+/******************************************************************************
+ *
+ * Complex data types
+ *
+ *****************************************************************************/
+
+struct acpi_object_event
+{
+       ACPI_OBJECT_COMMON_HEADER
+       void                                    *semaphore;
+};
+
+
+#define INFINITE_CONCURRENCY        0xFF
+
+struct acpi_object_method
+{
+       ACPI_OBJECT_COMMON_HEADER
+       u8                                      method_flags;
+       u8                                      param_count;
+       u32                                     aml_length;
+       void                                    *semaphore;
+       u8                                      *aml_start;
+       u8                                      concurrency;
+       u8                                      thread_count;
+       acpi_owner_id                           owning_id;
+};
+
+
+struct acpi_object_mutex
+{
+       ACPI_OBJECT_COMMON_HEADER
+       u16                                     sync_level;
+       u16                                     acquisition_depth;
+       struct acpi_thread_state                *owner_thread;
+       void                                    *semaphore;
+       union acpi_operand_object               *prev;              /* Link for list of acquired mutexes */
+       union acpi_operand_object               *next;              /* Link for list of acquired mutexes */
+       struct acpi_namespace_node              *node;              /* containing object */
+};
+
+
+struct acpi_object_region
+{
+       ACPI_OBJECT_COMMON_HEADER
+
+       u8                                      space_id;
+       union acpi_operand_object               *handler;           /* Handler for region access */
+       struct acpi_namespace_node              *node;              /* containing object */
+       union acpi_operand_object               *next;
+       u32                                     length;
+       acpi_physical_address                   address;
+};
+
+
+/******************************************************************************
+ *
+ * Objects that can be notified.  All share a common notify_info area.
+ *
+ *****************************************************************************/
+
+struct acpi_object_notify_common            /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_NOTIFY_INFO
+};
+
+
+struct acpi_object_device
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_NOTIFY_INFO
+       struct acpi_gpe_block_info              *gpe_block;
+};
+
+
+struct acpi_object_power_resource
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_NOTIFY_INFO
+       u32                                     system_level;
+       u32                                     resource_order;
+};
+
+
+struct acpi_object_processor
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_NOTIFY_INFO
+       u32                                     proc_id;
+       u32                                     length;
+       acpi_io_address                         address;
+};
+
+
+struct acpi_object_thermal_zone
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_NOTIFY_INFO
+};
+
+
+/******************************************************************************
+ *
+ * Fields.  All share a common header/info field.
+ *
+ *****************************************************************************/
+
+struct acpi_object_field_common                         /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_FIELD_INFO
+       union acpi_operand_object               *region_obj;        /* Containing Operation Region object */
+                         /* (REGION/BANK fields only) */
+};
+
+
+struct acpi_object_region_field
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_FIELD_INFO
+       union acpi_operand_object               *region_obj;        /* Containing op_region object */
+};
+
+
+struct acpi_object_bank_field
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_FIELD_INFO
+       union acpi_operand_object               *region_obj;        /* Containing op_region object */
+       union acpi_operand_object               *bank_obj;          /* bank_select Register object */
+};
+
+
+struct acpi_object_index_field
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_FIELD_INFO
+
+       /*
+        * No "region_obj" pointer needed since the Index and Data registers
+        * are each field definitions unto themselves.
+        */
+       union acpi_operand_object               *index_obj;         /* Index register */
+       union acpi_operand_object               *data_obj;          /* Data register */
+};
+
+
+/* The buffer_field is different in that it is part of a Buffer, not an op_region */
+
+struct acpi_object_buffer_field
+{
+       ACPI_OBJECT_COMMON_HEADER
+       ACPI_COMMON_FIELD_INFO
+       union acpi_operand_object               *buffer_obj;        /* Containing Buffer object */
+};
+
+
+/******************************************************************************
+ *
+ * Objects for handlers
+ *
+ *****************************************************************************/
+
+struct acpi_object_notify_handler
+{
+       ACPI_OBJECT_COMMON_HEADER
+       struct acpi_namespace_node              *node;              /* Parent device */
+       acpi_notify_handler                     handler;
+       void                                    *context;
+};
+
+
+/* Flags for address handler */
+
+#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED  0x1
+
+
+struct acpi_object_addr_handler
+{
+       ACPI_OBJECT_COMMON_HEADER
+       u8                                      space_id;
+       u16                                     hflags;
+       acpi_adr_space_handler                  handler;
+       struct acpi_namespace_node              *node;              /* Parent device */
+       void                                    *context;
+       acpi_adr_space_setup                    setup;
+       union acpi_operand_object               *region_list;       /* regions using this handler */
+       union acpi_operand_object               *next;
+};
+
+
+/******************************************************************************
+ *
+ * Special internal objects
+ *
+ *****************************************************************************/
+
+/*
+ * The Reference object type is used for these opcodes:
+ * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op
+ */
+struct acpi_object_reference
+{
+       ACPI_OBJECT_COMMON_HEADER
+       u8                                      target_type;        /* Used for index_op */
+       u16                                     opcode;
+       u32                                     offset;             /* Used for arg_op, local_op, and index_op */
+       void                                    *object;            /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object  */
+       struct acpi_namespace_node              *node;
+       union acpi_operand_object               **where;
+};
+
+
+/*
+ * Extra object is used as additional storage for types that
+ * have AML code in their declarations (term_args) that must be
+ * evaluated at run time.
+ *
+ * Currently: Region and field_unit types
+ */
+struct acpi_object_extra
+{
+       ACPI_OBJECT_COMMON_HEADER
+       u8                                      byte_fill1;
+       u16                                     word_fill1;
+       u32                                     aml_length;
+       u8                                      *aml_start;
+       struct acpi_namespace_node              *method_REG;        /* _REG method for this region (if any) */
+       void                                    *region_context;    /* Region-specific data */
+};
+
+
+/* Additional data that can be attached to namespace nodes */
+
+struct acpi_object_data
+{
+       ACPI_OBJECT_COMMON_HEADER
+       acpi_object_handler                     handler;
+       void                                    *pointer;
+};
+
+
+/* Structure used when objects are cached for reuse */
+
+struct acpi_object_cache_list
+{
+       ACPI_OBJECT_COMMON_HEADER
+       union acpi_operand_object               *next;              /* Link for object cache and internal lists*/
+};
+
+
+/******************************************************************************
+ *
+ * union acpi_operand_object Descriptor - a giant union of all of the above
+ *
+ *****************************************************************************/
+
+union acpi_operand_object
+{
+       struct acpi_object_common               common;
+       struct acpi_object_integer              integer;
+       struct acpi_object_string               string;
+       struct acpi_object_buffer               buffer;
+       struct acpi_object_package              package;
+       struct acpi_object_event                event;
+       struct acpi_object_method               method;
+       struct acpi_object_mutex                mutex;
+       struct acpi_object_region               region;
+       struct acpi_object_notify_common        common_notify;
+       struct acpi_object_device               device;
+       struct acpi_object_power_resource       power_resource;
+       struct acpi_object_processor            processor;
+       struct acpi_object_thermal_zone         thermal_zone;
+       struct acpi_object_field_common         common_field;
+       struct acpi_object_region_field         field;
+       struct acpi_object_buffer_field         buffer_field;
+       struct acpi_object_bank_field           bank_field;
+       struct acpi_object_index_field          index_field;
+       struct acpi_object_notify_handler       notify;
+       struct acpi_object_addr_handler         address_space;
+       struct acpi_object_reference            reference;
+       struct acpi_object_extra                extra;
+       struct acpi_object_data                 data;
+       struct acpi_object_cache_list           cache;
+};
+
+
+/******************************************************************************
+ *
+ * union acpi_descriptor - objects that share a common descriptor identifier
+ *
+ *****************************************************************************/
+
+
+/* Object descriptor types */
+
+#define ACPI_DESC_TYPE_CACHED           0x01        /* Used only when object is cached */
+#define ACPI_DESC_TYPE_STATE            0x02
+#define ACPI_DESC_TYPE_STATE_UPDATE     0x03
+#define ACPI_DESC_TYPE_STATE_PACKAGE    0x04
+#define ACPI_DESC_TYPE_STATE_CONTROL    0x05
+#define ACPI_DESC_TYPE_STATE_RPSCOPE    0x06
+#define ACPI_DESC_TYPE_STATE_PSCOPE     0x07
+#define ACPI_DESC_TYPE_STATE_WSCOPE     0x08
+#define ACPI_DESC_TYPE_STATE_RESULT     0x09
+#define ACPI_DESC_TYPE_STATE_NOTIFY     0x0A
+#define ACPI_DESC_TYPE_STATE_THREAD     0x0B
+#define ACPI_DESC_TYPE_WALK             0x0C
+#define ACPI_DESC_TYPE_PARSER           0x0D
+#define ACPI_DESC_TYPE_OPERAND          0x0E
+#define ACPI_DESC_TYPE_NAMED            0x0F
+#define ACPI_DESC_TYPE_MAX              0x0F
+
+
+union acpi_descriptor
+{
+       u8                                      descriptor_id;  /* To differentiate various internal objs */\
+       union acpi_operand_object               object;
+       struct acpi_namespace_node              node;
+       union acpi_parse_object                 op;
+};
+
+
+#endif /* _ACOBJECT_H */
diff --git a/xen/include/acpi/acoutput.h b/xen/include/acpi/acoutput.h
new file mode 100644 (file)
index 0000000..0ed98ae
--- /dev/null
@@ -0,0 +1,185 @@
+/******************************************************************************
+ *
+ * Name: acoutput.h -- debug output
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACOUTPUT_H__
+#define __ACOUTPUT_H__
+
+/*
+ * Debug levels and component IDs.  These are used to control the
+ * granularity of the output of the DEBUG_PRINT macro -- on a per-
+ * component basis and a per-exception-type basis.
+ */
+
+/* Component IDs are used in the global "debug_layer" */
+
+#define ACPI_UTILITIES              0x00000001
+#define ACPI_HARDWARE               0x00000002
+#define ACPI_EVENTS                 0x00000004
+#define ACPI_TABLES                 0x00000008
+#define ACPI_NAMESPACE              0x00000010
+#define ACPI_PARSER                 0x00000020
+#define ACPI_DISPATCHER             0x00000040
+#define ACPI_EXECUTER               0x00000080
+#define ACPI_RESOURCES              0x00000100
+#define ACPI_CA_DEBUGGER            0x00000200
+#define ACPI_OS_SERVICES            0x00000400
+#define ACPI_CA_DISASSEMBLER        0x00000800
+
+/* Component IDs for ACPI tools and utilities */
+
+#define ACPI_COMPILER               0x00001000
+#define ACPI_TOOLS                  0x00002000
+
+#define ACPI_ALL_COMPONENTS         0x00003FFF
+#define ACPI_COMPONENT_DEFAULT      (ACPI_ALL_COMPONENTS)
+
+
+/* Component IDs reserved for ACPI drivers */
+
+#define ACPI_ALL_DRIVERS            0xFFFF0000
+
+
+/*
+ * Raw debug output levels, do not use these in the DEBUG_PRINT macros
+ */
+#define ACPI_LV_ERROR               0x00000001
+#define ACPI_LV_WARN                0x00000002
+#define ACPI_LV_INIT                0x00000004
+#define ACPI_LV_DEBUG_OBJECT        0x00000008
+#define ACPI_LV_INFO                0x00000010
+#define ACPI_LV_ALL_EXCEPTIONS      0x0000001F
+
+/* Trace verbosity level 1 [Standard Trace Level] */
+
+#define ACPI_LV_INIT_NAMES          0x00000020
+#define ACPI_LV_PARSE               0x00000040
+#define ACPI_LV_LOAD                0x00000080
+#define ACPI_LV_DISPATCH            0x00000100
+#define ACPI_LV_EXEC                0x00000200
+#define ACPI_LV_NAMES               0x00000400
+#define ACPI_LV_OPREGION            0x00000800
+#define ACPI_LV_BFIELD              0x00001000
+#define ACPI_LV_TABLES              0x00002000
+#define ACPI_LV_VALUES              0x00004000
+#define ACPI_LV_OBJECTS             0x00008000
+#define ACPI_LV_RESOURCES           0x00010000
+#define ACPI_LV_USER_REQUESTS       0x00020000
+#define ACPI_LV_PACKAGE             0x00040000
+#define ACPI_LV_VERBOSITY1          0x0007FF40 | ACPI_LV_ALL_EXCEPTIONS
+
+/* Trace verbosity level 2 [Function tracing and memory allocation] */
+
+#define ACPI_LV_ALLOCATIONS         0x00100000
+#define ACPI_LV_FUNCTIONS           0x00200000
+#define ACPI_LV_OPTIMIZATIONS       0x00400000
+#define ACPI_LV_VERBOSITY2          0x00700000 | ACPI_LV_VERBOSITY1
+#define ACPI_LV_ALL                 ACPI_LV_VERBOSITY2
+
+/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */
+
+#define ACPI_LV_MUTEX               0x01000000
+#define ACPI_LV_THREADS             0x02000000
+#define ACPI_LV_IO                  0x04000000
+#define ACPI_LV_INTERRUPTS          0x08000000
+#define ACPI_LV_VERBOSITY3          0x0F000000 | ACPI_LV_VERBOSITY2
+
+/* Exceptionally verbose output -- also used in the global "debug_level" */
+
+#define ACPI_LV_AML_DISASSEMBLE     0x10000000
+#define ACPI_LV_VERBOSE_INFO        0x20000000
+#define ACPI_LV_FULL_TABLES         0x40000000
+#define ACPI_LV_EVENTS              0x80000000
+
+#define ACPI_LV_VERBOSE             0xF0000000
+
+
+/*
+ * Debug level macros that are used in the DEBUG_PRINT macros
+ */
+#define ACPI_DEBUG_LEVEL(dl)        (u32) dl,__LINE__,&_dbg
+
+/* Exception level -- used in the global "debug_level" */
+
+#define ACPI_DB_ERROR               ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
+#define ACPI_DB_WARN                ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
+#define ACPI_DB_INIT                ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
+#define ACPI_DB_DEBUG_OBJECT        ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
+#define ACPI_DB_INFO                ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
+#define ACPI_DB_ALL_EXCEPTIONS      ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
+
+
+/* Trace level -- also used in the global "debug_level" */
+
+#define ACPI_DB_INIT_NAMES          ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
+#define ACPI_DB_THREADS             ACPI_DEBUG_LEVEL (ACPI_LV_THREADS)
+#define ACPI_DB_PARSE               ACPI_DEBUG_LEVEL (ACPI_LV_PARSE)
+#define ACPI_DB_DISPATCH            ACPI_DEBUG_LEVEL (ACPI_LV_DISPATCH)
+#define ACPI_DB_LOAD                ACPI_DEBUG_LEVEL (ACPI_LV_LOAD)
+#define ACPI_DB_EXEC                ACPI_DEBUG_LEVEL (ACPI_LV_EXEC)
+#define ACPI_DB_NAMES               ACPI_DEBUG_LEVEL (ACPI_LV_NAMES)
+#define ACPI_DB_OPREGION            ACPI_DEBUG_LEVEL (ACPI_LV_OPREGION)
+#define ACPI_DB_BFIELD              ACPI_DEBUG_LEVEL (ACPI_LV_BFIELD)
+#define ACPI_DB_TABLES              ACPI_DEBUG_LEVEL (ACPI_LV_TABLES)
+#define ACPI_DB_FUNCTIONS           ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS)
+#define ACPI_DB_OPTIMIZATIONS       ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS)
+#define ACPI_DB_VALUES              ACPI_DEBUG_LEVEL (ACPI_LV_VALUES)
+#define ACPI_DB_OBJECTS             ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS)
+#define ACPI_DB_ALLOCATIONS         ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS)
+#define ACPI_DB_RESOURCES           ACPI_DEBUG_LEVEL (ACPI_LV_RESOURCES)
+#define ACPI_DB_IO                  ACPI_DEBUG_LEVEL (ACPI_LV_IO)
+#define ACPI_DB_INTERRUPTS          ACPI_DEBUG_LEVEL (ACPI_LV_INTERRUPTS)
+#define ACPI_DB_USER_REQUESTS       ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS)
+#define ACPI_DB_PACKAGE             ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE)
+#define ACPI_DB_MUTEX               ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
+
+#define ACPI_DB_ALL                 ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
+
+
+/* Defaults for debug_level, debug and normal */
+
+#define ACPI_DEBUG_DEFAULT          (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
+#define ACPI_NORMAL_DEFAULT         (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
+#define ACPI_DEBUG_ALL              (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
+
+
+#endif /* __ACOUTPUT_H__ */
diff --git a/xen/include/acpi/acparser.h b/xen/include/acpi/acparser.h
new file mode 100644 (file)
index 0000000..562e660
--- /dev/null
@@ -0,0 +1,347 @@
+/******************************************************************************
+ *
+ * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+#ifndef __ACPARSER_H__
+#define __ACPARSER_H__
+
+
+#define OP_HAS_RETURN_VALUE             1
+
+/* variable # arguments */
+
+#define ACPI_VAR_ARGS                   ACPI_UINT32_MAX
+
+
+#define ACPI_PARSE_DELETE_TREE          0x0001
+#define ACPI_PARSE_NO_TREE_DELETE       0x0000
+#define ACPI_PARSE_TREE_MASK            0x0001
+
+#define ACPI_PARSE_LOAD_PASS1           0x0010
+#define ACPI_PARSE_LOAD_PASS2           0x0020
+#define ACPI_PARSE_EXECUTE              0x0030
+#define ACPI_PARSE_MODE_MASK            0x0030
+
+#define ACPI_PARSE_DEFERRED_OP          0x0100
+
+/* Parser external interfaces */
+
+acpi_status
+acpi_psx_load_table (
+       u8                              *pcode_addr,
+       u32                             pcode_length);
+
+acpi_status
+acpi_psx_execute (
+       struct acpi_namespace_node      *method_node,
+       union acpi_operand_object       **params,
+       union acpi_operand_object       **return_obj_desc);
+
+
+/******************************************************************************
+ *
+ * Parser interfaces
+ *
+ *****************************************************************************/
+
+
+/* psargs - Parse AML opcode arguments */
+
+u8 *
+acpi_ps_get_next_package_end (
+       struct acpi_parse_state         *parser_state);
+
+u32
+acpi_ps_get_next_package_length (
+       struct acpi_parse_state         *parser_state);
+
+char *
+acpi_ps_get_next_namestring (
+       struct acpi_parse_state         *parser_state);
+
+void
+acpi_ps_get_next_simple_arg (
+       struct acpi_parse_state         *parser_state,
+       u32                             arg_type,
+       union acpi_parse_object         *arg);
+
+acpi_status
+acpi_ps_get_next_namepath (
+       struct acpi_walk_state          *walk_state,
+       struct acpi_parse_state         *parser_state,
+       union acpi_parse_object         *arg,
+       u8                              method_call);
+
+union acpi_parse_object *
+acpi_ps_get_next_field (
+       struct acpi_parse_state         *parser_state);
+
+acpi_status
+acpi_ps_get_next_arg (
+       struct acpi_walk_state          *walk_state,
+       struct acpi_parse_state         *parser_state,
+       u32                             arg_type,
+       union acpi_parse_object         **return_arg);
+
+
+/* psfind */
+
+union acpi_parse_object *
+acpi_ps_find_name (
+       union acpi_parse_object         *scope,
+       u32                             name,
+       u32                             opcode);
+
+union acpi_parse_object*
+acpi_ps_get_parent (
+       union acpi_parse_object         *op);
+
+
+/* psopcode - AML Opcode information */
+
+const struct acpi_opcode_info *
+acpi_ps_get_opcode_info (
+       u16                             opcode);
+
+char *
+acpi_ps_get_opcode_name (
+       u16                             opcode);
+
+
+/* psparse - top level parsing routines */
+
+u32
+acpi_ps_get_opcode_size (
+       u32                             opcode);
+
+void
+acpi_ps_complete_this_op (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op);
+
+acpi_status
+acpi_ps_next_parse_state (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op,
+       acpi_status                     callback_status);
+
+acpi_status
+acpi_ps_find_object (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         **out_op);
+
+void
+acpi_ps_delete_parse_tree (
+       union acpi_parse_object         *root);
+
+acpi_status
+acpi_ps_parse_loop (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ps_parse_aml (
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ps_parse_table (
+       u8                              *aml,
+       u32                             aml_size,
+       acpi_parse_downwards            descending_callback,
+       acpi_parse_upwards              ascending_callback,
+       union acpi_parse_object         **root_object);
+
+u16
+acpi_ps_peek_opcode (
+       struct acpi_parse_state         *state);
+
+
+/* psscope - Scope stack management routines */
+
+
+acpi_status
+acpi_ps_init_scope (
+       struct acpi_parse_state         *parser_state,
+       union acpi_parse_object         *root);
+
+union acpi_parse_object *
+acpi_ps_get_parent_scope (
+       struct acpi_parse_state         *state);
+
+u8
+acpi_ps_has_completed_scope (
+       struct acpi_parse_state         *parser_state);
+
+void
+acpi_ps_pop_scope (
+       struct acpi_parse_state         *parser_state,
+       union acpi_parse_object         **op,
+       u32                             *arg_list,
+       u32                             *arg_count);
+
+acpi_status
+acpi_ps_push_scope (
+       struct acpi_parse_state         *parser_state,
+       union acpi_parse_object         *op,
+       u32                             remaining_args,
+       u32                             arg_count);
+
+void
+acpi_ps_cleanup_scope (
+       struct acpi_parse_state         *state);
+
+
+/* pstree - parse tree manipulation routines */
+
+void
+acpi_ps_append_arg(
+       union acpi_parse_object         *op,
+       union acpi_parse_object         *arg);
+
+union acpi_parse_object*
+acpi_ps_find (
+       union acpi_parse_object         *scope,
+       char                            *path,
+       u16                             opcode,
+       u32                             create);
+
+union acpi_parse_object *
+acpi_ps_get_arg(
+       union acpi_parse_object         *op,
+       u32                              argn);
+
+union acpi_parse_object *
+acpi_ps_get_child (
+       union acpi_parse_object         *op);
+
+union acpi_parse_object *
+acpi_ps_get_depth_next (
+       union acpi_parse_object         *origin,
+       union acpi_parse_object         *op);
+
+
+/* pswalk - parse tree walk routines */
+
+acpi_status
+acpi_ps_walk_parsed_aml (
+       union acpi_parse_object         *start_op,
+       union acpi_parse_object         *end_op,
+       union acpi_operand_object       *mth_desc,
+       struct acpi_namespace_node      *start_node,
+       union acpi_operand_object       **params,
+       union acpi_operand_object       **caller_return_desc,
+       acpi_owner_id                   owner_id,
+       acpi_parse_downwards            descending_callback,
+       acpi_parse_upwards              ascending_callback);
+
+acpi_status
+acpi_ps_get_next_walk_op (
+       struct acpi_walk_state          *walk_state,
+       union acpi_parse_object         *op,
+       acpi_parse_upwards              ascending_callback);
+
+acpi_status
+acpi_ps_delete_completed_op (
+       struct acpi_walk_state          *walk_state);
+
+
+/* psutils - parser utilities */
+
+union acpi_parse_object *
+acpi_ps_create_scope_op (
+       void);
+
+void
+acpi_ps_init_op (
+       union acpi_parse_object         *op,
+       u16                             opcode);
+
+union acpi_parse_object *
+acpi_ps_alloc_op (
+       u16                             opcode);
+
+void
+acpi_ps_free_op (
+       union acpi_parse_object         *op);
+
+void
+acpi_ps_delete_parse_cache (
+       void);
+
+u8
+acpi_ps_is_leading_char (
+       u32                             c);
+
+u8
+acpi_ps_is_prefix_char (
+       u32                             c);
+
+u32
+acpi_ps_get_name(
+       union acpi_parse_object         *op);
+
+void
+acpi_ps_set_name(
+       union acpi_parse_object         *op,
+       u32                             name);
+
+
+/* psdump - display parser tree */
+
+u32
+acpi_ps_sprint_path (
+       char                            *buffer_start,
+       u32                             buffer_size,
+       union acpi_parse_object         *op);
+
+u32
+acpi_ps_sprint_op (
+       char                            *buffer_start,
+       u32                             buffer_size,
+       union acpi_parse_object         *op);
+
+void
+acpi_ps_show (
+       union acpi_parse_object         *op);
+
+
+#endif /* __ACPARSER_H__ */
diff --git a/xen/include/acpi/acpi.h b/xen/include/acpi/acpi.h
new file mode 100644 (file)
index 0000000..bb5bd8f
--- /dev/null
@@ -0,0 +1,69 @@
+/******************************************************************************
+ *
+ * Name: acpi.h - Master include file, Publics and external data.
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACPI_H__
+#define __ACPI_H__
+
+/*
+ * Common includes for all ACPI driver files
+ * We put them here because we don't want to duplicate them
+ * in the rest of the source code again and again.
+ */
+#include "acconfig.h"           /* Configuration constants */
+#include "platform/acenv.h"     /* Target environment specific items */
+#include "actypes.h"            /* Fundamental common data types */
+#include "acexcep.h"            /* ACPI exception codes */
+#include "acmacros.h"           /* C macros */
+#include "actbl.h"              /* ACPI table definitions */
+#include "aclocal.h"            /* Internal data types */
+#include "acoutput.h"           /* Error output and Debug macros */
+#include "acpiosxf.h"           /* Interfaces to the ACPI-to-OS layer*/
+#include "acpixf.h"             /* ACPI core subsystem external interfaces */
+#include "acobject.h"           /* ACPI internal object */
+#include "acstruct.h"           /* Common structures */
+#include "acglobal.h"           /* All global variables */
+#include "achware.h"            /* Hardware defines and interfaces */
+#include "acutils.h"            /* Utility interfaces */
+
+
+#endif /* __ACPI_H__ */
diff --git a/xen/include/acpi/acpi_bus.h b/xen/include/acpi/acpi_bus.h
new file mode 100644 (file)
index 0000000..1469db0
--- /dev/null
@@ -0,0 +1,316 @@
+/*
+ *  acpi_bus.h - ACPI Bus Driver ($Revision: 22 $)
+ *
+ *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
+ *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#ifndef __ACPI_BUS_H__
+#define __ACPI_BUS_H__
+
+#include <xen/version.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,4))
+#include <xen/device.h>
+#define CONFIG_LDM
+#endif
+
+#include <acpi/acpi.h>
+
+extern int                     acpi_disabled;
+
+/* TBD: Make dynamic */
+#define ACPI_MAX_HANDLES       10
+struct acpi_handle_list {
+       u32                     count;
+       acpi_handle             handles[ACPI_MAX_HANDLES];
+};
+
+
+/* acpi_utils.h */
+acpi_status
+acpi_extract_package (
+       union acpi_object       *package,
+       struct acpi_buffer      *format,
+       struct acpi_buffer      *buffer);
+acpi_status
+acpi_evaluate_integer (
+       acpi_handle             handle,
+       acpi_string             pathname,
+       struct acpi_object_list *arguments,
+       unsigned long           *data);
+acpi_status
+acpi_evaluate_reference (
+       acpi_handle             handle,
+       acpi_string             pathname,
+       struct acpi_object_list *arguments,
+       struct acpi_handle_list *list);
+
+
+#ifdef CONFIG_ACPI_BUS
+
+/*#include <xen/proc_fs.h>*/
+
+#define ACPI_BUS_FILE_ROOT     "acpi"
+/*extern struct proc_dir_entry *acpi_root_dir;*/
+extern FADT_DESCRIPTOR         acpi_fadt;
+
+enum acpi_bus_removal_type {
+       ACPI_BUS_REMOVAL_NORMAL = 0,
+       ACPI_BUS_REMOVAL_EJECT,
+       ACPI_BUS_REMOVAL_SUPRISE,
+       ACPI_BUS_REMOVAL_TYPE_COUNT
+};
+
+enum acpi_bus_device_type {
+       ACPI_BUS_TYPE_DEVICE    = 0,
+       ACPI_BUS_TYPE_POWER,
+       ACPI_BUS_TYPE_PROCESSOR,
+       ACPI_BUS_TYPE_THERMAL,
+       ACPI_BUS_TYPE_SYSTEM,
+       ACPI_BUS_TYPE_POWER_BUTTON,
+       ACPI_BUS_TYPE_SLEEP_BUTTON,
+       ACPI_BUS_DEVICE_TYPE_COUNT
+};
+
+struct acpi_driver;
+struct acpi_device;
+
+
+/*
+ * ACPI Driver
+ * -----------
+ */
+
+typedef int (*acpi_op_add)     (struct acpi_device *device);
+typedef int (*acpi_op_remove)  (struct acpi_device *device, int type);
+typedef int (*acpi_op_lock)    (struct acpi_device *device, int type);
+typedef int (*acpi_op_start)   (struct acpi_device *device);
+typedef int (*acpi_op_stop)    (struct acpi_device *device, int type);
+typedef int (*acpi_op_suspend) (struct acpi_device *device, int state);
+typedef int (*acpi_op_resume)  (struct acpi_device *device, int state);
+typedef int (*acpi_op_scan)    (struct acpi_device *device);
+typedef int (*acpi_op_bind)    (struct acpi_device *device);
+
+struct acpi_device_ops {
+       acpi_op_add             add;
+       acpi_op_remove          remove;
+       acpi_op_lock            lock;
+       acpi_op_start           start;
+       acpi_op_stop            stop;
+       acpi_op_suspend         suspend;
+       acpi_op_resume          resume;
+       acpi_op_scan            scan;
+       acpi_op_bind            bind;
+};
+
+struct acpi_driver {
+       struct list_head        node;
+       char                    name[80];
+       char                    class[80];
+       int                     references;
+       char                    *ids;           /* Supported Hardware IDs */
+       struct acpi_device_ops  ops;
+};
+
+/*
+ * ACPI Device
+ * -----------
+ */
+
+/* Status (_STA) */
+
+struct acpi_device_status {
+       u32                     present:1;
+       u32                     enabled:1;
+       u32                     show_in_ui:1;
+       u32                     functional:1;
+       u32                     battery_present:1;
+       u32                     reserved:27;
+};
+
+
+/* Flags */
+
+struct acpi_device_flags {
+       u32                     dynamic_status:1;
+       u32                     hardware_id:1;
+       u32                     compatible_ids:1;
+       u32                     bus_address:1;
+       u32                     unique_id:1;
+       u32                     removable:1;
+       u32                     ejectable:1;
+       u32                     lockable:1;
+       u32                     suprise_removal_ok:1;
+       u32                     power_manageable:1;
+       u32                     performance_manageable:1;
+       u32                     reserved:21;
+};
+
+
+/* File System */
+
+struct acpi_device_dir {
+       struct proc_dir_entry   *entry;
+};
+
+#define acpi_device_dir(d)     ((d)->dir.entry)
+
+
+/* Plug and Play */
+
+typedef char                   acpi_bus_id[5];
+typedef unsigned long          acpi_bus_address;
+typedef char                   acpi_hardware_id[9];
+typedef char                   acpi_unique_id[9];
+typedef char                   acpi_device_name[40];
+typedef char                   acpi_device_class[20];
+
+struct acpi_device_pnp {
+       acpi_bus_id             bus_id;                        /* Object name */
+       acpi_bus_address        bus_address;                          /* _ADR */
+       acpi_hardware_id        hardware_id;                          /* _HID */
+       struct acpi_compatible_id_list *cid_list;                    /* _CIDs */
+       acpi_unique_id          unique_id;                            /* _UID */
+       acpi_device_name        device_name;             /* Driver-determined */
+       acpi_device_class       device_class;            /*        "          */
+};
+
+#define acpi_device_bid(d)     ((d)->pnp.bus_id)
+#define acpi_device_adr(d)     ((d)->pnp.bus_address)
+#define acpi_device_hid(d)     ((d)->pnp.hardware_id)
+#define acpi_device_uid(d)     ((d)->pnp.unique_id)
+#define acpi_device_name(d)    ((d)->pnp.device_name)
+#define acpi_device_class(d)   ((d)->pnp.device_class)
+
+
+/* Power Management */
+
+struct acpi_device_power_flags {
+       u32                     explicit_get:1;              /* _PSC present? */
+       u32                     power_resources:1;         /* Power resources */
+       u32                     inrush_current:1;         /* Serialize Dx->D0 */
+       u32                     wake_capable:1;          /* Wakeup supported? */
+       u32                     wake_enabled:1;         /* Enabled for wakeup */
+       u32                     power_removed:1;           /* Optimize Dx->D0 */
+       u32                     reserved:26;
+};
+
+struct acpi_device_power_state {
+       struct {
+               u8                      valid:1;        
+               u8                      explicit_set:1;      /* _PSx present? */
+               u8                      reserved:6;
+       }                       flags;
+       int                     power;            /* % Power (compared to D0) */
+       int                     latency;        /* Dx->D0 time (microseconds) */
+       struct acpi_handle_list resources;      /* Power resources referenced */
+};
+
+struct acpi_device_power {
+       int                     state;                       /* Current state */
+       struct acpi_device_power_flags flags;
+       struct acpi_device_power_state states[4];     /* Power states (D0-D3) */
+};
+
+
+/* Performance Management */
+
+struct acpi_device_perf_flags {
+       u8                      reserved:8;
+};
+
+struct acpi_device_perf_state {
+       struct {
+               u8                      valid:1;        
+               u8                      reserved:7;
+       }                       flags;
+       u8                      power;            /* % Power (compared to P0) */
+       u8                      performance;      /* % Performance (    "   ) */
+       int                     latency;        /* Px->P0 time (microseconds) */
+};
+
+struct acpi_device_perf {
+       int                     state;
+       struct acpi_device_perf_flags flags;
+       int                     state_count;
+       struct acpi_device_perf_state *states;
+};
+
+
+/* Device */
+
+struct acpi_device {
+       acpi_handle             handle;
+       struct acpi_device      *parent;
+       struct list_head        children;
+       struct list_head        node;
+       struct acpi_device_status status;
+       struct acpi_device_flags flags;
+       struct acpi_device_pnp  pnp;
+       struct acpi_device_power power;
+       struct acpi_device_perf performance;
+       struct acpi_device_dir  dir;
+       struct acpi_device_ops  ops;
+       struct acpi_driver      *driver;
+       void                    *driver_data;
+#ifdef CONFIG_LDM
+       struct device           dev;
+#endif
+};
+
+#define acpi_driver_data(d)    ((d)->driver_data)
+
+
+/*
+ * Events
+ * ------
+ */
+
+struct acpi_bus_event {
+       struct list_head        node;
+       acpi_device_class       device_class;
+       acpi_bus_id             bus_id;
+       u32                     type;
+       u32                     data;
+};
+
+
+/*
+ * External Functions
+ */
+
+int acpi_bus_get_device(acpi_handle, struct acpi_device **device);
+int acpi_bus_get_status (struct acpi_device *device);
+int acpi_bus_get_power (acpi_handle handle, int *state);
+int acpi_bus_set_power (acpi_handle handle, int state);
+int acpi_bus_generate_event (struct acpi_device *device, u8 type, int data);
+int acpi_bus_receive_event (struct acpi_bus_event *event);
+int acpi_bus_register_driver (struct acpi_driver *driver);
+int acpi_bus_unregister_driver (struct acpi_driver *driver);
+int acpi_bus_scan (struct acpi_device *device);
+int acpi_init (void);
+void acpi_exit (void);
+
+
+#endif /*CONFIG_ACPI_BUS*/
+
+#endif /*__ACPI_BUS_H__*/
diff --git a/xen/include/acpi/acpi_drivers.h b/xen/include/acpi/acpi_drivers.h
new file mode 100644 (file)
index 0000000..3b5273a
--- /dev/null
@@ -0,0 +1,347 @@
+/*
+ *  acpi_drivers.h  ($Revision: 32 $)
+ *
+ *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
+ *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or (at
+ *  your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#ifndef __ACPI_DRIVERS_H__
+#define __ACPI_DRIVERS_H__
+
+#include <xen/acpi.h>
+#include "acpi_bus.h"
+
+
+#define ACPI_MAX_STRING                        80
+
+
+/* --------------------------------------------------------------------------
+                                    ACPI Bus
+   -------------------------------------------------------------------------- */
+
+#define ACPI_BUS_COMPONENT             0x00010000
+#define ACPI_BUS_CLASS                 "system_bus"
+#define ACPI_BUS_HID                   "ACPI_BUS"
+#define ACPI_BUS_DRIVER_NAME           "ACPI Bus Driver"
+#define ACPI_BUS_DEVICE_NAME           "System Bus"
+
+
+/* --------------------------------------------------------------------------
+                                  AC Adapter
+   -------------------------------------------------------------------------- */
+
+#define ACPI_AC_COMPONENT              0x00020000
+#define ACPI_AC_CLASS                  "ac_adapter"
+#define ACPI_AC_HID                    "ACPI0003"
+#define ACPI_AC_DRIVER_NAME            "ACPI AC Adapter Driver"
+#define ACPI_AC_DEVICE_NAME            "AC Adapter"
+#define ACPI_AC_FILE_STATE             "state"
+#define ACPI_AC_NOTIFY_STATUS          0x80
+#define ACPI_AC_STATUS_OFFLINE         0x00
+#define ACPI_AC_STATUS_ONLINE          0x01
+#define ACPI_AC_STATUS_UNKNOWN         0xFF
+
+
+/* --------------------------------------------------------------------------
+                                     Battery
+   -------------------------------------------------------------------------- */
+
+#define ACPI_BATTERY_COMPONENT         0x00040000
+#define ACPI_BATTERY_CLASS             "battery"
+#define ACPI_BATTERY_HID               "PNP0C0A"
+#define ACPI_BATTERY_DRIVER_NAME       "ACPI Battery Driver"
+#define ACPI_BATTERY_DEVICE_NAME       "Battery"
+#define ACPI_BATTERY_FILE_INFO         "info"
+#define ACPI_BATTERY_FILE_STATUS       "state"
+#define ACPI_BATTERY_FILE_ALARM                "alarm"
+#define ACPI_BATTERY_NOTIFY_STATUS     0x80
+#define ACPI_BATTERY_NOTIFY_INFO       0x81
+#define ACPI_BATTERY_UNITS_WATTS       "mW"
+#define ACPI_BATTERY_UNITS_AMPS                "mA"
+
+
+/* --------------------------------------------------------------------------
+                                      Button
+   -------------------------------------------------------------------------- */
+
+#define ACPI_BUTTON_COMPONENT          0x00080000
+#define ACPI_BUTTON_DRIVER_NAME                "ACPI Button Driver"
+#define ACPI_BUTTON_CLASS              "button"
+#define ACPI_BUTTON_FILE_INFO          "info"
+#define ACPI_BUTTON_FILE_STATE         "state"
+#define ACPI_BUTTON_TYPE_UNKNOWN       0x00
+#define ACPI_BUTTON_NOTIFY_STATUS      0x80
+
+#define ACPI_BUTTON_SUBCLASS_POWER     "power"
+#define ACPI_BUTTON_HID_POWER          "PNP0C0C"       
+#define ACPI_BUTTON_HID_POWERF         "ACPI_FPB"
+#define ACPI_BUTTON_DEVICE_NAME_POWER  "Power Button (CM)"
+#define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)"
+#define ACPI_BUTTON_TYPE_POWER         0x01
+#define ACPI_BUTTON_TYPE_POWERF                0x02
+
+#define ACPI_BUTTON_SUBCLASS_SLEEP     "sleep"
+#define ACPI_BUTTON_HID_SLEEP          "PNP0C0E"
+#define ACPI_BUTTON_HID_SLEEPF         "ACPI_FSB"
+#define ACPI_BUTTON_DEVICE_NAME_SLEEP  "Sleep Button (CM)"
+#define ACPI_BUTTON_DEVICE_NAME_SLEEPF "Sleep Button (FF)"
+#define ACPI_BUTTON_TYPE_SLEEP         0x03
+#define ACPI_BUTTON_TYPE_SLEEPF                0x04
+
+#define ACPI_BUTTON_SUBCLASS_LID       "lid"
+#define ACPI_BUTTON_HID_LID            "PNP0C0D"
+#define ACPI_BUTTON_DEVICE_NAME_LID    "Lid Switch"
+#define ACPI_BUTTON_TYPE_LID           0x05
+
+
+/* --------------------------------------------------------------------------
+                                Embedded Controller
+   -------------------------------------------------------------------------- */
+
+#define ACPI_EC_COMPONENT              0x00100000
+#define ACPI_EC_CLASS                  "embedded_controller"
+#define ACPI_EC_HID                    "PNP0C09"
+#define ACPI_EC_DRIVER_NAME            "ACPI Embedded Controller Driver"
+#define ACPI_EC_DEVICE_NAME            "Embedded Controller"
+#define ACPI_EC_FILE_INFO              "info"
+
+#ifdef CONFIG_ACPI_EC
+
+int acpi_ec_ecdt_probe (void);
+int acpi_ec_init (void);
+void acpi_ec_exit (void);
+
+#endif
+
+
+/* --------------------------------------------------------------------------
+                                       Fan
+   -------------------------------------------------------------------------- */
+
+#define ACPI_FAN_COMPONENT             0x00200000
+#define ACPI_FAN_CLASS                 "fan"
+#define ACPI_FAN_HID                   "PNP0C0B"
+#define ACPI_FAN_DRIVER_NAME           "ACPI Fan Driver"
+#define ACPI_FAN_DEVICE_NAME           "Fan"
+#define ACPI_FAN_FILE_STATE            "state"
+#define ACPI_FAN_NOTIFY_STATUS         0x80
+
+
+/* --------------------------------------------------------------------------
+                                       PCI
+   -------------------------------------------------------------------------- */
+
+#ifdef CONFIG_ACPI_PCI
+
+#define ACPI_PCI_COMPONENT             0x00400000
+
+/* ACPI PCI Root Bridge (pci_root.c) */
+
+#define ACPI_PCI_ROOT_CLASS            "pci_bridge"
+#define ACPI_PCI_ROOT_HID              "PNP0A03"
+#define ACPI_PCI_ROOT_DRIVER_NAME      "ACPI PCI Root Bridge Driver"
+#define ACPI_PCI_ROOT_DEVICE_NAME      "PCI Root Bridge"
+
+int acpi_pci_root_init (void);
+void acpi_pci_root_exit (void);
+
+/* ACPI PCI Interrupt Link (pci_link.c) */
+
+#define ACPI_PCI_LINK_CLASS            "pci_irq_routing"
+#define ACPI_PCI_LINK_HID              "PNP0C0F"
+#define ACPI_PCI_LINK_DRIVER_NAME      "ACPI PCI Interrupt Link Driver"
+#define ACPI_PCI_LINK_DEVICE_NAME      "PCI Interrupt Link"
+#define ACPI_PCI_LINK_FILE_INFO                "info"
+#define ACPI_PCI_LINK_FILE_STATUS      "state"
+
+int acpi_pci_link_check (void);
+int acpi_pci_link_get_irq (acpi_handle handle, int index, int* edge_level, int* active_high_low);
+int acpi_pci_link_init (void);
+void acpi_pci_link_exit (void);
+
+/* ACPI PCI Interrupt Routing (pci_irq.c) */
+
+int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus);
+
+/* ACPI PCI Device Binding (pci_bind.c) */
+
+struct pci_bus;
+
+int acpi_pci_bind (struct acpi_device *device);
+int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus);
+
+#endif /*CONFIG_ACPI_PCI*/
+
+
+/* --------------------------------------------------------------------------
+                                  Power Resource
+   -------------------------------------------------------------------------- */
+
+#define ACPI_POWER_COMPONENT           0x00800000
+#define ACPI_POWER_CLASS               "power_resource"
+#define ACPI_POWER_HID                 "ACPI_PWR"
+#define ACPI_POWER_DRIVER_NAME         "ACPI Power Resource Driver"
+#define ACPI_POWER_DEVICE_NAME         "Power Resource"
+#define ACPI_POWER_FILE_INFO           "info"
+#define ACPI_POWER_FILE_STATUS         "state"
+#define ACPI_POWER_RESOURCE_STATE_OFF  0x00
+#define ACPI_POWER_RESOURCE_STATE_ON   0x01
+#define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF
+
+#ifdef CONFIG_ACPI_POWER
+
+int acpi_power_get_inferred_state (struct acpi_device *device);
+int acpi_power_transition (struct acpi_device *device, int state);
+int acpi_power_init (void);
+void acpi_power_exit (void);
+
+#endif
+
+
+/* --------------------------------------------------------------------------
+                                    Processor
+   -------------------------------------------------------------------------- */
+
+#define ACPI_PROCESSOR_COMPONENT       0x01000000
+#define ACPI_PROCESSOR_CLASS           "processor"
+#define ACPI_PROCESSOR_HID             "ACPI_CPU"
+#define ACPI_PROCESSOR_DRIVER_NAME     "ACPI Processor Driver"
+#define ACPI_PROCESSOR_DEVICE_NAME     "Processor"
+#define ACPI_PROCESSOR_FILE_INFO       "info"
+#define ACPI_PROCESSOR_FILE_POWER      "power"
+#define ACPI_PROCESSOR_FILE_PERFORMANCE        "performance"
+#define ACPI_PROCESSOR_FILE_THROTTLING "throttling"
+#define ACPI_PROCESSOR_FILE_LIMIT      "limit"
+#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
+#define ACPI_PROCESSOR_NOTIFY_POWER    0x81
+#define ACPI_PROCESSOR_LIMIT_NONE      0x00
+#define ACPI_PROCESSOR_LIMIT_INCREMENT 0x01
+#define ACPI_PROCESSOR_LIMIT_DECREMENT 0x02
+
+int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
+
+
+/* --------------------------------------------------------------------------
+                                     System
+   -------------------------------------------------------------------------- */
+
+#define ACPI_SYSTEM_COMPONENT          0x02000000
+#define ACPI_SYSTEM_CLASS              "system"
+#define ACPI_SYSTEM_HID                        "ACPI_SYS"
+#define ACPI_SYSTEM_DRIVER_NAME                "ACPI System Driver"
+#define ACPI_SYSTEM_DEVICE_NAME                "System"
+#define ACPI_SYSTEM_FILE_INFO          "info"
+#define ACPI_SYSTEM_FILE_EVENT         "event"
+#define ACPI_SYSTEM_FILE_ALARM         "alarm"
+#define ACPI_SYSTEM_FILE_DSDT          "dsdt"
+#define ACPI_SYSTEM_FILE_FADT          "fadt"
+#define ACPI_SYSTEM_FILE_SLEEP         "sleep"
+#define ACPI_SYSTEM_FILE_DEBUG_LAYER   "debug_layer"
+#define ACPI_SYSTEM_FILE_DEBUG_LEVEL   "debug_level"
+
+#ifdef CONFIG_ACPI_SYSTEM
+
+int acpi_system_init (void);
+void acpi_system_exit (void);
+
+#endif
+
+
+/* --------------------------------------------------------------------------
+                                 Thermal Zone
+   -------------------------------------------------------------------------- */
+
+#define ACPI_THERMAL_COMPONENT         0x04000000
+#define ACPI_THERMAL_CLASS             "thermal_zone"
+#define ACPI_THERMAL_HID               "ACPI_THM"
+#define ACPI_THERMAL_DRIVER_NAME       "ACPI Thermal Zone Driver"
+#define ACPI_THERMAL_DEVICE_NAME       "Thermal Zone"
+#define ACPI_THERMAL_FILE_STATE                "state"
+#define ACPI_THERMAL_FILE_TEMPERATURE  "temperature"
+#define ACPI_THERMAL_FILE_TRIP_POINTS  "trip_points"
+#define ACPI_THERMAL_FILE_COOLING_MODE "cooling_mode"
+#define ACPI_THERMAL_FILE_POLLING_FREQ "polling_frequency"
+#define ACPI_THERMAL_NOTIFY_TEMPERATURE        0x80
+#define ACPI_THERMAL_NOTIFY_THRESHOLDS 0x81
+#define ACPI_THERMAL_NOTIFY_DEVICES    0x82
+#define ACPI_THERMAL_NOTIFY_CRITICAL   0xF0
+#define ACPI_THERMAL_NOTIFY_HOT                0xF1
+#define ACPI_THERMAL_MODE_ACTIVE       0x00
+#define ACPI_THERMAL_MODE_PASSIVE      0x01
+#define ACPI_THERMAL_PATH_POWEROFF     "/sbin/poweroff"
+
+
+/* --------------------------------------------------------------------------
+                                Debug Support
+   -------------------------------------------------------------------------- */
+
+#define ACPI_DEBUG_RESTORE     0
+#define ACPI_DEBUG_LOW         1
+#define ACPI_DEBUG_MEDIUM      2
+#define ACPI_DEBUG_HIGH                3
+#define ACPI_DEBUG_DRIVERS     4
+
+/*extern u32 acpi_dbg_level;*/
+/*extern u32 acpi_dbg_layer;*/
+
+static inline void
+acpi_set_debug (
+       u32                     flag)
+{
+       static u32              layer_save;
+       static u32              level_save;
+
+       switch (flag) {
+       case ACPI_DEBUG_RESTORE:
+               acpi_dbg_layer = layer_save;
+               acpi_dbg_level = level_save;
+               break;
+       case ACPI_DEBUG_LOW:
+       case ACPI_DEBUG_MEDIUM:
+       case ACPI_DEBUG_HIGH:
+       case ACPI_DEBUG_DRIVERS:
+               layer_save = acpi_dbg_layer;
+               level_save = acpi_dbg_level;
+               break;
+       }
+
+       switch (flag) {
+       case ACPI_DEBUG_LOW:
+               acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
+               acpi_dbg_level = ACPI_DEBUG_DEFAULT;
+               break;
+       case ACPI_DEBUG_MEDIUM:
+               acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
+               acpi_dbg_level = ACPI_LV_FUNCTIONS | ACPI_LV_ALL_EXCEPTIONS;
+               break;
+       case ACPI_DEBUG_HIGH:
+               acpi_dbg_layer = 0xFFFFFFFF;
+               acpi_dbg_level = 0xFFFFFFFF;
+               break;
+       case ACPI_DEBUG_DRIVERS:
+               acpi_dbg_layer = ACPI_ALL_DRIVERS;
+               acpi_dbg_level = 0xFFFFFFFF;
+               break;
+       }
+}
+
+
+#endif /*__ACPI_DRIVERS_H__*/
diff --git a/xen/include/acpi/acpiosxf.h b/xen/include/acpi/acpiosxf.h
new file mode 100644 (file)
index 0000000..6f48523
--- /dev/null
@@ -0,0 +1,373 @@
+
+/******************************************************************************
+ *
+ * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL).  These
+ *                    interfaces must be implemented by OSL to interface the
+ *                    ACPI components to the host operating system.
+ *
+ *****************************************************************************/
+
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACPIOSXF_H__
+#define __ACPIOSXF_H__
+
+#include "platform/acenv.h"
+#include "actypes.h"
+
+
+/* Priorities for acpi_os_queue_for_execution */
+
+#define OSD_PRIORITY_GPE            1
+#define OSD_PRIORITY_HIGH           2
+#define OSD_PRIORITY_MED            3
+#define OSD_PRIORITY_LO             4
+
+#define ACPI_NO_UNIT_LIMIT          ((u32) -1)
+#define ACPI_MUTEX_SEM              1
+
+
+/* Functions for acpi_os_signal */
+
+#define ACPI_SIGNAL_FATAL           0
+#define ACPI_SIGNAL_BREAKPOINT      1
+
+struct acpi_signal_fatal_info
+{
+       u32                             type;
+       u32                             code;
+       u32                             argument;
+};
+
+
+/*
+ * OSL Initialization and shutdown primitives
+ */
+
+acpi_status
+acpi_os_initialize (
+       void);
+
+acpi_status
+acpi_os_terminate (
+       void);
+
+
+/*
+ * ACPI Table interfaces
+ */
+
+acpi_status
+acpi_os_get_root_pointer (
+       u32                             flags,
+       struct acpi_pointer             *address);
+
+acpi_status
+acpi_os_predefined_override (
+       const struct acpi_predefined_names *init_val,
+       acpi_string                         *new_val);
+
+acpi_status
+acpi_os_table_override (
+       struct acpi_table_header        *existing_table,
+       struct acpi_table_header        **new_table);
+
+
+/*
+ * Synchronization primitives
+ */
+
+acpi_status
+acpi_os_create_semaphore (
+       u32                             max_units,
+       u32                             initial_units,
+       acpi_handle                     *out_handle);
+
+acpi_status
+acpi_os_delete_semaphore (
+       acpi_handle                     handle);
+
+acpi_status
+acpi_os_wait_semaphore (
+       acpi_handle                     handle,
+       u32                             units,
+       u16                             timeout);
+
+acpi_status
+acpi_os_signal_semaphore (
+       acpi_handle                     handle,
+       u32                             units);
+
+acpi_status
+acpi_os_create_lock (
+       acpi_handle                     *out_handle);
+
+void
+acpi_os_delete_lock (
+       acpi_handle                     handle);
+
+void
+acpi_os_acquire_lock (
+       acpi_handle                     handle,
+       u32                             flags);
+
+void
+acpi_os_release_lock (
+       acpi_handle                     handle,
+       u32                             flags);
+
+
+/*
+ * Memory allocation and mapping
+ */
+
+void *
+acpi_os_allocate (
+       acpi_size                       size);
+
+void
+acpi_os_free (
+       void *                          memory);
+
+acpi_status
+acpi_os_map_memory (
+       acpi_physical_address           physical_address,
+       acpi_size                       size,
+       void                            **logical_address);
+
+void
+acpi_os_unmap_memory (
+       void                            *logical_address,
+       acpi_size                       size);
+
+acpi_status
+acpi_os_get_physical_address (
+       void                            *logical_address,
+       acpi_physical_address           *physical_address);
+
+
+/*
+ * Interrupt handlers
+ */
+
+acpi_status
+acpi_os_install_interrupt_handler (
+       u32                             interrupt_number,
+       OSD_HANDLER             service_routine,
+       void                            *context);
+
+acpi_status
+acpi_os_remove_interrupt_handler (
+       u32                             interrupt_number,
+       OSD_HANDLER             service_routine);
+
+
+/*
+ * Threads and Scheduling
+ */
+
+u32
+acpi_os_get_thread_id (
+       void);
+
+acpi_status
+acpi_os_queue_for_execution (
+       u32                             priority,
+       OSD_EXECUTION_CALLBACK  function,
+       void                            *context);
+
+void
+acpi_os_sleep (
+       u32                             seconds,
+       u32                             milliseconds);
+
+void
+acpi_os_stall (
+       u32                             microseconds);
+
+
+/*
+ * Platform and hardware-independent I/O interfaces
+ */
+
+acpi_status
+acpi_os_read_port (
+       acpi_io_address                 address,
+       u32                             *value,
+       u32                             width);
+
+acpi_status
+acpi_os_write_port (
+       acpi_io_address                 address,
+       u32                             value,
+       u32                             width);
+
+
+/*
+ * Platform and hardware-independent physical memory interfaces
+ */
+
+acpi_status
+acpi_os_read_memory (
+       acpi_physical_address           address,
+       u32                             *value,
+       u32                             width);
+
+acpi_status
+acpi_os_write_memory (
+       acpi_physical_address           address,
+       u32                             value,
+       u32                             width);
+
+
+/*
+ * Platform and hardware-independent PCI configuration space access
+ */
+
+acpi_status
+acpi_os_read_pci_configuration (
+       struct acpi_pci_id              *pci_id,
+       u32                             register,
+       void                            *value,
+       u32                             width);
+
+acpi_status
+acpi_os_write_pci_configuration (
+       struct acpi_pci_id              *pci_id,
+       u32                             register,
+       acpi_integer                    value,
+       u32                             width);
+
+/*
+ * Interim function needed for PCI IRQ routing
+ */
+void
+acpi_os_derive_pci_id(
+       acpi_handle                     rhandle,
+       acpi_handle                     chandle,
+       struct acpi_pci_id              **pci_id);
+
+/*
+ * Miscellaneous
+ */
+
+u8
+acpi_os_readable (
+       void                            *pointer,
+       acpi_size                       length);
+
+u8
+acpi_os_writable (
+       void                            *pointer,
+       acpi_size                       length);
+
+u32
+acpi_os_get_timer (
+       void);
+
+acpi_status
+acpi_os_signal (
+       u32                             function,
+       void                            *info);
+
+/*
+ * Debug print routines
+ */
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_os_printf (
+       const char                      *format,
+       ...);
+
+void
+acpi_os_vprintf (
+       const char                      *format,
+       va_list                 args);
+
+void
+acpi_os_redirect_output (
+       void                            *destination);
+
+
+/*
+ * Debug input
+ */
+
+u32
+acpi_os_get_line (
+       char                            *buffer);
+
+
+/*
+ * Directory manipulation
+ */
+
+void *
+acpi_os_open_directory (
+       char                            *pathname,
+       char                            *wildcard_spec,
+       char                            requested_file_type);
+
+/* requeste_file_type values */
+
+#define REQUEST_FILE_ONLY                   0
+#define REQUEST_DIR_ONLY                    1
+
+
+char *
+acpi_os_get_next_filename (
+       void                            *dir_handle);
+
+void
+acpi_os_close_directory (
+       void                            *dir_handle);
+
+/*
+ * Debug
+ */
+
+void
+acpi_os_dbg_assert(
+       void                            *failed_assertion,
+       void                            *file_name,
+       u32                             line_number,
+       char                            *message);
+
+
+#endif /* __ACPIOSXF_H__ */
diff --git a/xen/include/acpi/acpixf.h b/xen/include/acpi/acpixf.h
new file mode 100644 (file)
index 0000000..fcebceb
--- /dev/null
@@ -0,0 +1,462 @@
+
+/******************************************************************************
+ *
+ * Name: acpixf.h - External interfaces to the ACPI subsystem
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+#ifndef __ACXFACE_H__
+#define __ACXFACE_H__
+
+#include "actypes.h"
+#include "actbl.h"
+
+
+ /*
+ * Global interfaces
+ */
+
+acpi_status
+acpi_initialize_subsystem (
+       void);
+
+acpi_status
+acpi_enable_subsystem (
+       u32                             flags);
+
+acpi_status
+acpi_initialize_objects (
+       u32                             flags);
+
+acpi_status
+acpi_terminate (
+       void);
+
+acpi_status
+acpi_subsystem_status (
+       void);
+
+acpi_status
+acpi_enable (
+       void);
+
+acpi_status
+acpi_disable (
+       void);
+
+acpi_status
+acpi_get_system_info (
+       struct acpi_buffer              *ret_buffer);
+
+const char *
+acpi_format_exception (
+       acpi_status                     exception);
+
+acpi_status
+acpi_purge_cached_objects (
+       void);
+
+acpi_status
+acpi_install_initialization_handler (
+       acpi_init_handler               handler,
+       u32                             function);
+
+/*
+ * ACPI Memory manager
+ */
+
+void *
+acpi_allocate (
+       u32                             size);
+
+void *
+acpi_callocate (
+       u32                             size);
+
+void
+acpi_free (
+       void                            *address);
+
+
+/*
+ * ACPI table manipulation interfaces
+ */
+
+acpi_status
+acpi_find_root_pointer (
+       u32                             flags,
+       struct acpi_pointer             *rsdp_address);
+
+acpi_status
+acpi_load_tables (
+       void);
+
+acpi_status
+acpi_load_table (
+       struct acpi_table_header        *table_ptr);
+
+acpi_status
+acpi_unload_table (
+       acpi_table_type                 table_type);
+
+acpi_status
+acpi_get_table_header (
+       acpi_table_type                 table_type,
+       u32                             instance,
+       struct acpi_table_header        *out_table_header);
+
+acpi_status
+acpi_get_table (
+       acpi_table_type                 table_type,
+       u32                             instance,
+       struct acpi_buffer              *ret_buffer);
+
+acpi_status
+acpi_get_firmware_table (
+       acpi_string                     signature,
+       u32                             instance,
+       u32                             flags,
+       struct acpi_table_header        **table_pointer);
+
+
+/*
+ * Namespace and name interfaces
+ */
+
+acpi_status
+acpi_walk_namespace (
+       acpi_object_type                type,
+       acpi_handle                     start_object,
+       u32                             max_depth,
+       acpi_walk_callback              user_function,
+       void                            *context,
+       void                            **return_value);
+
+acpi_status
+acpi_get_devices (
+       char                            *HID,
+       acpi_walk_callback              user_function,
+       void                            *context,
+       void                            **return_value);
+
+acpi_status
+acpi_get_name (
+       acpi_handle                     handle,
+       u32                             name_type,
+       struct acpi_buffer              *ret_path_ptr);
+
+acpi_status
+acpi_get_handle (
+       acpi_handle                     parent,
+       acpi_string                     pathname,
+       acpi_handle                     *ret_handle);
+
+acpi_status
+acpi_attach_data (
+       acpi_handle                     obj_handle,
+       acpi_object_handler             handler,
+       void                            *data);
+
+acpi_status
+acpi_detach_data (
+       acpi_handle                     obj_handle,
+       acpi_object_handler             handler);
+
+acpi_status
+acpi_get_data (
+       acpi_handle                     obj_handle,
+       acpi_object_handler             handler,
+       void                            **data);
+
+
+/*
+ * Object manipulation and enumeration
+ */
+
+acpi_status
+acpi_evaluate_object (
+       acpi_handle                     object,
+       acpi_string                     pathname,
+       struct acpi_object_list         *parameter_objects,
+       struct acpi_buffer              *return_object_buffer);
+
+acpi_status
+acpi_evaluate_object_typed (
+       acpi_handle                     object,
+       acpi_string                     pathname,
+       struct acpi_object_list         *external_params,
+       struct acpi_buffer              *return_buffer,
+       acpi_object_type                return_type);
+
+acpi_status
+acpi_get_object_info (
+       acpi_handle                     handle,
+       struct acpi_buffer              *return_buffer);
+
+acpi_status
+acpi_get_next_object (
+       acpi_object_type                type,
+       acpi_handle                     parent,
+       acpi_handle                     child,
+       acpi_handle                     *out_handle);
+
+acpi_status
+acpi_get_type (
+       acpi_handle                     object,
+       acpi_object_type                *out_type);
+
+acpi_status
+acpi_get_parent (
+       acpi_handle                     object,
+       acpi_handle                     *out_handle);
+
+
+/*
+ * Event handler interfaces
+ */
+
+acpi_status
+acpi_install_fixed_event_handler (
+       u32                             acpi_event,
+       acpi_event_handler              handler,
+       void                            *context);
+
+acpi_status
+acpi_remove_fixed_event_handler (
+       u32                             acpi_event,
+       acpi_event_handler              handler);
+
+acpi_status
+acpi_install_notify_handler (
+       acpi_handle                     device,
+       u32                             handler_type,
+       acpi_notify_handler             handler,
+       void                            *context);
+
+acpi_status
+acpi_remove_notify_handler (
+       acpi_handle                     device,
+       u32                             handler_type,
+       acpi_notify_handler             handler);
+
+acpi_status
+acpi_install_address_space_handler (
+       acpi_handle                     device,
+       acpi_adr_space_type             space_id,
+       acpi_adr_space_handler          handler,
+       acpi_adr_space_setup            setup,
+       void                            *context);
+
+acpi_status
+acpi_remove_address_space_handler (
+       acpi_handle                     device,
+       acpi_adr_space_type             space_id,
+       acpi_adr_space_handler          handler);
+
+acpi_status
+acpi_install_gpe_handler (
+       acpi_handle                     gpe_device,
+       u32                             gpe_number,
+       u32                             type,
+       acpi_gpe_handler                handler,
+       void                            *context);
+
+acpi_status
+acpi_acquire_global_lock (
+       u16                             timeout,
+       u32                             *handle);
+
+acpi_status
+acpi_release_global_lock (
+       u32                             handle);
+
+acpi_status
+acpi_remove_gpe_handler (
+       acpi_handle                     gpe_device,
+       u32                             gpe_number,
+       acpi_gpe_handler                handler);
+
+acpi_status
+acpi_enable_event (
+       u32                             event,
+       u32                             flags);
+
+acpi_status
+acpi_disable_event (
+       u32                             event,
+       u32                             flags);
+
+acpi_status
+acpi_clear_event (
+       u32                             event);
+
+acpi_status
+acpi_get_event_status (
+       u32                             event,
+       acpi_event_status               *event_status);
+
+acpi_status
+acpi_enable_gpe (
+       acpi_handle                     gpe_device,
+       u32                             gpe_number,
+       u32                             flags);
+
+acpi_status
+acpi_disable_gpe (
+       acpi_handle                     gpe_device,
+       u32                             gpe_number,
+       u32                             flags);
+
+acpi_status
+acpi_clear_gpe (
+       acpi_handle                     gpe_device,
+       u32                             gpe_number,
+       u32                             flags);
+
+acpi_status
+acpi_get_gpe_status (
+       acpi_handle                     gpe_device,
+       u32                             gpe_number,
+       u32                             flags,
+       acpi_event_status               *event_status);
+
+acpi_status
+acpi_install_gpe_block (
+       acpi_handle                     gpe_device,
+       struct acpi_generic_address     *gpe_block_address,
+       u32                             register_count,
+       u32                             interrupt_level);
+
+acpi_status
+acpi_remove_gpe_block (
+       acpi_handle                     gpe_device);
+
+
+/*
+ * Resource interfaces
+ */
+
+typedef
+acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) (
+       struct acpi_resource            *resource,
+       void                            *context);
+
+
+acpi_status
+acpi_get_current_resources(
+       acpi_handle                     device_handle,
+       struct acpi_buffer              *ret_buffer);
+
+acpi_status
+acpi_get_possible_resources(
+       acpi_handle                     device_handle,
+       struct acpi_buffer              *ret_buffer);
+
+acpi_status
+acpi_walk_resources (
+       acpi_handle                             device_handle,
+       char                                    *path,
+       ACPI_WALK_RESOURCE_CALLBACK     user_function,
+       void                                    *context);
+
+acpi_status
+acpi_set_current_resources (
+       acpi_handle                     device_handle,
+       struct acpi_buffer              *in_buffer);
+
+acpi_status
+acpi_get_irq_routing_table (
+       acpi_handle                     bus_device_handle,
+       struct acpi_buffer              *ret_buffer);
+
+acpi_status
+acpi_resource_to_address64 (
+       struct acpi_resource            *resource,
+       struct acpi_resource_address64 *out);
+
+/*
+ * Hardware (ACPI device) interfaces
+ */
+
+acpi_status
+acpi_get_register (
+       u32                             register_id,
+       u32                             *return_value,
+       u32                             flags);
+
+acpi_status
+acpi_set_register (
+       u32                             register_id,
+       u32                             value,
+       u32                             flags);
+
+acpi_status
+acpi_set_firmware_waking_vector (
+       acpi_physical_address           physical_address);
+
+acpi_status
+acpi_get_firmware_waking_vector (
+       acpi_physical_address           *physical_address);
+
+acpi_status
+acpi_get_sleep_type_data (
+       u8                              sleep_state,
+       u8                              *slp_typ_a,
+       u8                              *slp_typ_b);
+
+acpi_status
+acpi_enter_sleep_state_prep (
+       u8                              sleep_state);
+
+acpi_status
+acpi_enter_sleep_state (
+       u8                              sleep_state);
+
+acpi_status
+acpi_enter_sleep_state_s4bios (
+       void);
+
+acpi_status
+acpi_leave_sleep_state (
+       u8                              sleep_state);
+
+
+#endif /* __ACXFACE_H__ */
diff --git a/xen/include/acpi/acresrc.h b/xen/include/acpi/acresrc.h
new file mode 100644 (file)
index 0000000..e1a9187
--- /dev/null
@@ -0,0 +1,391 @@
+/******************************************************************************
+ *
+ * Name: acresrc.h - Resource Manager function prototypes
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACRESRC_H__
+#define __ACRESRC_H__
+
+
+/*
+ *  Function prototypes called from Acpi* APIs
+ */
+
+acpi_status
+acpi_rs_get_prt_method_data (
+       acpi_handle                     handle,
+       struct acpi_buffer              *ret_buffer);
+
+
+acpi_status
+acpi_rs_get_crs_method_data (
+       acpi_handle                     handle,
+       struct acpi_buffer              *ret_buffer);
+
+acpi_status
+acpi_rs_get_prs_method_data (
+       acpi_handle                     handle,
+       struct acpi_buffer              *ret_buffer);
+
+acpi_status
+acpi_rs_get_method_data (
+       acpi_handle                     handle,
+       char                            *path,
+       struct acpi_buffer              *ret_buffer);
+
+acpi_status
+acpi_rs_set_srs_method_data (
+       acpi_handle                     handle,
+       struct acpi_buffer              *ret_buffer);
+
+acpi_status
+acpi_rs_create_resource_list (
+       union acpi_operand_object       *byte_stream_buffer,
+       struct acpi_buffer              *output_buffer);
+
+acpi_status
+acpi_rs_create_byte_stream (
+       struct acpi_resource            *linked_list_buffer,
+       struct acpi_buffer              *output_buffer);
+
+acpi_status
+acpi_rs_create_pci_routing_table (
+       union acpi_operand_object       *package_object,
+       struct acpi_buffer              *output_buffer);
+
+
+/*
+ * Function prototypes called from acpi_rs_create*
+ */
+void
+acpi_rs_dump_irq (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_address16 (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_address32 (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_address64 (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_dma (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_io (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_extended_irq (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_fixed_io (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_fixed_memory32 (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_memory24 (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_memory32 (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_start_depend_fns (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_vendor_specific (
+       union acpi_resource_data        *data);
+
+void
+acpi_rs_dump_resource_list (
+       struct acpi_resource            *resource);
+
+void
+acpi_rs_dump_irq_list (
+       u8                              *route_table);
+
+acpi_status
+acpi_rs_get_byte_stream_start (
+       u8                              *byte_stream_buffer,
+       u8                              **byte_stream_start,
+       u32                             *size);
+
+acpi_status
+acpi_rs_get_list_length (
+       u8                              *byte_stream_buffer,
+       u32                             byte_stream_buffer_length,
+       acpi_size                       *size_needed);
+
+acpi_status
+acpi_rs_get_byte_stream_length (
+       struct acpi_resource            *linked_list_buffer,
+       acpi_size                       *size_needed);
+
+acpi_status
+acpi_rs_get_pci_routing_table_length (
+       union acpi_operand_object       *package_object,
+       acpi_size                       *buffer_size_needed);
+
+acpi_status
+acpi_rs_byte_stream_to_list (
+       u8                              *byte_stream_buffer,
+       u32                             byte_stream_buffer_length,
+       u8                              *output_buffer);
+
+acpi_status
+acpi_rs_list_to_byte_stream (
+       struct acpi_resource            *linked_list,
+       acpi_size                       byte_stream_size_needed,
+       u8                              *output_buffer);
+
+acpi_status
+acpi_rs_io_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_fixed_io_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_io_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_fixed_io_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_irq_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_irq_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_dma_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_dma_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_address16_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_address16_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_address32_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_address32_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_address64_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_address64_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_start_depend_fns_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_end_depend_fns_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_start_depend_fns_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_end_depend_fns_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_memory24_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_memory24_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_memory32_range_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_fixed_memory32_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_memory32_range_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_fixed_memory32_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_extended_irq_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_extended_irq_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_end_tag_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_end_tag_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+acpi_status
+acpi_rs_vendor_resource (
+       u8                              *byte_stream_buffer,
+       acpi_size                       *bytes_consumed,
+       u8                              **output_buffer,
+       acpi_size                       *structure_size);
+
+acpi_status
+acpi_rs_vendor_stream (
+       struct acpi_resource            *linked_list,
+       u8                              **output_buffer,
+       acpi_size                       *bytes_consumed);
+
+u8
+acpi_rs_get_resource_type (
+       u8                              resource_start_byte);
+
+#endif  /* __ACRESRC_H__ */
diff --git a/xen/include/acpi/acstruct.h b/xen/include/acpi/acstruct.h
new file mode 100644 (file)
index 0000000..56a3782
--- /dev/null
@@ -0,0 +1,203 @@
+/******************************************************************************
+ *
+ * Name: acstruct.h - Internal structs
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACSTRUCT_H__
+#define __ACSTRUCT_H__
+
+
+/*****************************************************************************
+ *
+ * Tree walking typedefs and structs
+ *
+ ****************************************************************************/
+
+
+/*
+ * Walk state - current state of a parse tree walk.  Used for both a leisurely stroll through
+ * the tree (for whatever reason), and for control method execution.
+ */
+
+#define ACPI_NEXT_OP_DOWNWARD       1
+#define ACPI_NEXT_OP_UPWARD         2
+
+#define ACPI_WALK_NON_METHOD        0
+#define ACPI_WALK_METHOD            1
+#define ACPI_WALK_METHOD_RESTART    2
+#define ACPI_WALK_CONST_REQUIRED    3
+#define ACPI_WALK_CONST_OPTIONAL    4
+
+struct acpi_walk_state
+{
+       u8                                  data_type;                          /* To differentiate various internal objs MUST BE FIRST!*/\
+       acpi_owner_id                       owner_id;                           /* Owner of objects created during the walk */
+       u8                                  last_predicate;                     /* Result of last predicate */
+       u8                                  current_result;                     /* */
+       u8                                  next_op_info;                       /* Info about next_op */
+       u8                                  num_operands;                       /* Stack pointer for Operands[] array */
+       u8                                  return_used;
+       u8                                  walk_type;
+       u16                                 opcode;                             /* Current AML opcode */
+       u8                                  scope_depth;
+       u8                                  reserved1;
+       u32                                 arg_count;                          /* push for fixed or var args */
+       u32                                 aml_offset;
+       u32                                 arg_types;
+       u32                                 method_breakpoint;                  /* For single stepping */
+       u32                                 user_breakpoint;                    /* User AML breakpoint */
+       u32                                 parse_flags;
+       u32                                 prev_arg_types;
+
+       u8                                  *aml_last_while;
+       struct acpi_namespace_node          arguments[ACPI_METHOD_NUM_ARGS];    /* Control method arguments */
+       union acpi_operand_object           **caller_return_desc;
+       union acpi_generic_state            *control_state;                     /* List of control states (nested IFs) */
+       struct acpi_namespace_node          *deferred_node;                      /* Used when executing deferred opcodes */
+       struct acpi_namespace_node          local_variables[ACPI_METHOD_NUM_LOCALS];    /* Control method locals */
+       struct acpi_namespace_node          *method_call_node;                  /* Called method Node*/
+       union acpi_parse_object             *method_call_op;                    /* method_call Op if running a method */
+       union acpi_operand_object           *method_desc;                       /* Method descriptor if running a method */
+       struct acpi_namespace_node          *method_node;                       /* Method node if running a method. */
+       union acpi_parse_object             *op;                                /* Current parser op */
+       union acpi_operand_object           *operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
+       const struct acpi_opcode_info       *op_info;                           /* Info on current opcode */
+       union acpi_parse_object             *origin;                            /* Start of walk [Obsolete] */
+       union acpi_operand_object           **params;
+       struct acpi_parse_state             parser_state;                       /* Current state of parser */
+       union acpi_operand_object           *result_obj;
+       union acpi_generic_state            *results;                           /* Stack of accumulated results */
+       union acpi_operand_object           *return_desc;                       /* Return object, if any */
+       union acpi_generic_state            *scope_info;                        /* Stack of nested scopes */
+
+       union acpi_parse_object             *prev_op;                           /* Last op that was processed */
+       union acpi_parse_object             *next_op;                           /* next op to be processed */
+       acpi_parse_downwards                descending_callback;
+       acpi_parse_upwards                  ascending_callback;
+       struct acpi_thread_state            *thread;
+       struct acpi_walk_state              *next;                              /* Next walk_state in list */
+};
+
+
+/* Info used by acpi_ps_init_objects */
+
+struct acpi_init_walk_info
+{
+       u16                             method_count;
+       u16                             device_count;
+       u16                             op_region_count;
+       u16                             field_count;
+       u16                             buffer_count;
+       u16                             package_count;
+       u16                             op_region_init;
+       u16                             field_init;
+       u16                             buffer_init;
+       u16                             package_init;
+       u16                             object_count;
+       struct acpi_table_desc          *table_desc;
+};
+
+
+/* Info used by acpi_ns_initialize_devices */
+
+struct acpi_device_walk_info
+{
+       u16                             device_count;
+       u16                             num_STA;
+       u16                             num_INI;
+       struct acpi_table_desc          *table_desc;
+};
+
+
+/* TBD: [Restructure] Merge with struct above */
+
+struct acpi_walk_info
+{
+       u32                             debug_level;
+       u32                             owner_id;
+       u8                              display_type;
+};
+
+/* Display Types */
+
+#define ACPI_DISPLAY_SUMMARY    0
+#define ACPI_DISPLAY_OBJECTS    1
+
+struct acpi_get_devices_info
+{
+       acpi_walk_callback              user_function;
+       void                            *context;
+       char                            *hid;
+};
+
+
+union acpi_aml_operands
+{
+       union acpi_operand_object           *operands[7];
+
+       struct
+       {
+               struct acpi_object_integer      *type;
+               struct acpi_object_integer      *code;
+               struct acpi_object_integer      *argument;
+
+       } fatal;
+
+       struct
+       {
+               union acpi_operand_object       *source;
+               struct acpi_object_integer      *index;
+               union acpi_operand_object       *target;
+
+       } index;
+
+       struct
+       {
+               union acpi_operand_object       *source;
+               struct acpi_object_integer      *index;
+               struct acpi_object_integer      *length;
+               union acpi_operand_object       *target;
+
+       } mid;
+};
+
+
+#endif
diff --git a/xen/include/acpi/actables.h b/xen/include/acpi/actables.h
new file mode 100644 (file)
index 0000000..43112ab
--- /dev/null
@@ -0,0 +1,233 @@
+/******************************************************************************
+ *
+ * Name: actables.h - ACPI table management
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACTABLES_H__
+#define __ACTABLES_H__
+
+
+/* Used in acpi_tb_map_acpi_table for size parameter if table header is to be used */
+
+#define SIZE_IN_HEADER          0
+
+
+acpi_status
+acpi_tb_handle_to_object (
+       u16                             table_id,
+       struct acpi_table_desc          **table_desc);
+
+/*
+ * tbconvrt - Table conversion routines
+ */
+
+acpi_status
+acpi_tb_convert_to_xsdt (
+       struct acpi_table_desc          *table_info);
+
+acpi_status
+acpi_tb_convert_table_fadt (
+       void);
+
+acpi_status
+acpi_tb_build_common_facs (
+       struct acpi_table_desc          *table_info);
+
+u32
+acpi_tb_get_table_count (
+       struct rsdp_descriptor          *RSDP,
+       struct acpi_table_header        *RSDT);
+
+/*
+ * tbget - Table "get" routines
+ */
+
+acpi_status
+acpi_tb_get_table (
+       struct acpi_pointer             *address,
+       struct acpi_table_desc          *table_info);
+
+acpi_status
+acpi_tb_get_table_header (
+       struct acpi_pointer             *address,
+       struct acpi_table_header        *return_header);
+
+acpi_status
+acpi_tb_get_table_body (
+       struct acpi_pointer             *address,
+       struct acpi_table_header        *header,
+       struct acpi_table_desc          *table_info);
+
+acpi_status
+acpi_tb_get_this_table (
+       struct acpi_pointer             *address,
+       struct acpi_table_header        *header,
+       struct acpi_table_desc          *table_info);
+
+acpi_status
+acpi_tb_table_override (
+       struct acpi_table_header        *header,
+       struct acpi_table_desc          *table_info);
+
+acpi_status
+acpi_tb_get_table_ptr (
+       acpi_table_type                 table_type,
+       u32                             instance,
+       struct acpi_table_header        **table_ptr_loc);
+
+acpi_status
+acpi_tb_verify_rsdp (
+       struct acpi_pointer             *address);
+
+void
+acpi_tb_get_rsdt_address (
+       struct acpi_pointer             *out_address);
+
+acpi_status
+acpi_tb_validate_rsdt (
+       struct acpi_table_header        *table_ptr);
+
+acpi_status
+acpi_tb_get_required_tables (
+       void);
+
+acpi_status
+acpi_tb_get_primary_table (
+       struct acpi_pointer             *address,
+       struct acpi_table_desc          *table_info);
+
+acpi_status
+acpi_tb_get_secondary_table (
+       struct acpi_pointer             *address,
+       acpi_string                     signature,
+       struct acpi_table_desc          *table_info);
+
+/*
+ * tbinstall - Table installation
+ */
+
+acpi_status
+acpi_tb_install_table (
+       struct acpi_table_desc          *table_info);
+
+acpi_status
+acpi_tb_match_signature (
+       char                            *signature,
+       struct acpi_table_desc          *table_info,
+       u8                              search_type);
+
+acpi_status
+acpi_tb_recognize_table (
+       struct acpi_table_desc          *table_info,
+       u8                              search_type);
+
+acpi_status
+acpi_tb_init_table_descriptor (
+       acpi_table_type                 table_type,
+       struct acpi_table_desc          *table_info);
+
+
+/*
+ * tbremove - Table removal and deletion
+ */
+
+void
+acpi_tb_delete_all_tables (
+       void);
+
+void
+acpi_tb_delete_tables_by_type (
+       acpi_table_type                 type);
+
+void
+acpi_tb_delete_single_table (
+       struct acpi_table_desc          *table_desc);
+
+struct acpi_table_desc *
+acpi_tb_uninstall_table (
+       struct acpi_table_desc          *table_desc);
+
+
+/*
+ * tbrsd - RSDP, RSDT utilities
+ */
+
+acpi_status
+acpi_tb_get_table_rsdt (
+       void);
+
+u8 *
+acpi_tb_scan_memory_for_rsdp (
+       u8                              *start_address,
+       u32                             length);
+
+acpi_status
+acpi_tb_find_rsdp (
+       struct acpi_table_desc          *table_info,
+       u32                             flags);
+
+
+/*
+ * tbutils - common table utilities
+ */
+
+acpi_status
+acpi_tb_find_table (
+       char                            *signature,
+       char                            *oem_id,
+       char                            *oem_table_id,
+       struct acpi_table_header        **table_ptr);
+
+acpi_status
+acpi_tb_verify_table_checksum (
+       struct acpi_table_header        *table_header);
+
+u8
+acpi_tb_checksum (
+       void                            *buffer,
+       u32                             length);
+
+acpi_status
+acpi_tb_validate_table_header (
+       struct acpi_table_header        *table_header);
+
+
+#endif /* __ACTABLES_H__ */
diff --git a/xen/include/acpi/actbl.h b/xen/include/acpi/actbl.h
new file mode 100644 (file)
index 0000000..55680ad
--- /dev/null
@@ -0,0 +1,347 @@
+/******************************************************************************
+ *
+ * Name: actbl.h - Table data structures defined in ACPI specification
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACTBL_H__
+#define __ACTBL_H__
+
+
+/*
+ *  Values for description table header signatures
+ */
+#define RSDP_NAME               "RSDP"
+#define RSDP_SIG                "RSD PTR "  /* RSDT Pointer signature */
+#define APIC_SIG                "APIC"      /* Multiple APIC Description Table */
+#define DSDT_SIG                "DSDT"      /* Differentiated System Description Table */
+#define FADT_SIG                "FACP"      /* Fixed ACPI Description Table */
+#define FACS_SIG                "FACS"      /* Firmware ACPI Control Structure */
+#define PSDT_SIG                "PSDT"      /* Persistent System Description Table */
+#define RSDT_SIG                "RSDT"      /* Root System Description Table */
+#define XSDT_SIG                "XSDT"      /* Extended  System Description Table */
+#define SSDT_SIG                "SSDT"      /* Secondary System Description Table */
+#define SBST_SIG                "SBST"      /* Smart Battery Specification Table */
+#define SPIC_SIG                "SPIC"      /* IOSAPIC table */
+#define BOOT_SIG                "BOOT"      /* Boot table */
+
+
+#define GL_OWNED                0x02        /* Ownership of global lock is bit 1 */
+
+
+/*
+ * Common table types.  The base code can remain
+ * constant if the underlying tables are changed
+ */
+#define RSDT_DESCRIPTOR         struct rsdt_descriptor_rev2
+#define XSDT_DESCRIPTOR         struct xsdt_descriptor_rev2
+#define FACS_DESCRIPTOR         struct facs_descriptor_rev2
+#define FADT_DESCRIPTOR         struct fadt_descriptor_rev2
+
+
+#pragma pack(1)
+
+/*
+ * ACPI Version-independent tables
+ *
+ * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
+ * are in separate files.
+ */
+struct rsdp_descriptor         /* Root System Descriptor Pointer */
+{
+       char                            signature [8];          /* ACPI signature, contains "RSD PTR " */
+       u8                              checksum;               /* To make sum of struct == 0 */
+       char                            oem_id [6];             /* OEM identification */
+       u8                              revision;               /* Must be 0 for 1.0, 2 for 2.0 */
+       u32                             rsdt_physical_address;  /* 32-bit physical address of RSDT */
+       u32                             length;                 /* XSDT Length in bytes including hdr */
+       u64                             xsdt_physical_address;  /* 64-bit physical address of XSDT */
+       u8                              extended_checksum;      /* Checksum of entire table */
+       char                            reserved [3];           /* Reserved field must be 0 */
+};
+
+
+struct acpi_common_facs          /* Common FACS for internal use */
+{
+       u32                             *global_lock;
+       u64                             *firmware_waking_vector;
+       u8                              vector_width;
+};
+
+
+#define ACPI_TABLE_HEADER_DEF   /* ACPI common table header */ \
+       char                            signature [4];          /* ACPI signature (4 ASCII characters) */\
+       u32                             length;                 /* Length of table, in bytes, including header */\
+       u8                              revision;               /* ACPI Specification minor version # */\
+       u8                              checksum;               /* To make sum of entire table == 0 */\
+       char                            oem_id [6];             /* OEM identification */\
+       char                            oem_table_id [8];       /* OEM table identification */\
+       u32                             oem_revision;           /* OEM revision number */\
+       char                            asl_compiler_id [4];    /* ASL compiler vendor ID */\
+       u32                             asl_compiler_revision;  /* ASL compiler revision number */
+
+
+struct acpi_table_header         /* ACPI common table header */
+{
+       ACPI_TABLE_HEADER_DEF
+};
+
+
+/*
+ * MADT values and structures
+ */
+
+/* Values for MADT PCATCompat */
+
+#define DUAL_PIC                0
+#define MULTIPLE_APIC           1
+
+
+/* Master MADT */
+
+struct multiple_apic_table
+{
+       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
+       u32                             local_apic_address;     /* Physical address of local APIC */
+       u32                             PCATcompat      : 1;    /* A one indicates system also has dual 8259s */
+       u32                             reserved1       : 31;
+};
+
+
+/* Values for Type in APIC_HEADER_DEF */
+
+#define APIC_PROCESSOR          0
+#define APIC_IO                 1
+#define APIC_XRUPT_OVERRIDE     2
+#define APIC_NMI                3
+#define APIC_LOCAL_NMI          4
+#define APIC_ADDRESS_OVERRIDE   5
+#define APIC_IO_SAPIC           6
+#define APIC_LOCAL_SAPIC        7
+#define APIC_XRUPT_SOURCE       8
+#define APIC_RESERVED           9           /* 9 and greater are reserved */
+
+/*
+ * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
+ */
+#define APIC_HEADER_DEF                     /* Common APIC sub-structure header */\
+       u8                              type; \
+       u8                              length;
+
+struct apic_header
+{
+       APIC_HEADER_DEF
+};
+
+/* Values for MPS INTI flags */
+
+#define POLARITY_CONFORMS       0
+#define POLARITY_ACTIVE_HIGH    1
+#define POLARITY_RESERVED       2
+#define POLARITY_ACTIVE_LOW     3
+
+#define TRIGGER_CONFORMS        0
+#define TRIGGER_EDGE            1
+#define TRIGGER_RESERVED        2
+#define TRIGGER_LEVEL           3
+
+/* Common flag definitions */
+
+#define MPS_INTI_FLAGS \
+       u16                             polarity        : 2;    /* Polarity of APIC I/O input signals */\
+       u16                             trigger_mode    : 2;    /* Trigger mode of APIC input signals */\
+       u16                             reserved1       : 12;   /* Reserved, must be zero */
+
+#define LOCAL_APIC_FLAGS \
+       u32                             processor_enabled: 1;   /* Processor is usable if set */\
+       u32                             reserved2       : 31;   /* Reserved, must be zero */
+
+/* Sub-structures for MADT */
+
+struct madt_processor_apic
+{
+       APIC_HEADER_DEF
+       u8                              processor_id;           /* ACPI processor id */
+       u8                              local_apic_id;          /* Processor's local APIC id */
+       LOCAL_APIC_FLAGS
+};
+
+struct madt_io_apic
+{
+       APIC_HEADER_DEF
+       u8                              io_apic_id;             /* I/O APIC ID */
+       u8                              reserved;               /* Reserved - must be zero */
+       u32                             address;                /* APIC physical address */
+       u32                             interrupt;              /* Global system interrupt where INTI
+                         * lines start */
+};
+
+struct madt_interrupt_override
+{
+       APIC_HEADER_DEF
+       u8                              bus;                    /* 0 - ISA */
+       u8                              source;                 /* Interrupt source (IRQ) */
+       u32                             interrupt;              /* Global system interrupt */
+       MPS_INTI_FLAGS
+};
+
+struct madt_nmi_source
+{
+       APIC_HEADER_DEF
+       MPS_INTI_FLAGS
+       u32                             interrupt;              /* Global system interrupt */
+};
+
+struct madt_local_apic_nmi
+{
+       APIC_HEADER_DEF
+       u8                              processor_id;           /* ACPI processor id */
+       MPS_INTI_FLAGS
+       u8                              lint;                   /* LINTn to which NMI is connected */
+};
+
+struct madt_address_override
+{
+       APIC_HEADER_DEF
+       u16                             reserved;               /* Reserved - must be zero */
+       u64                             address;                /* APIC physical address */
+};
+
+struct madt_io_sapic
+{
+       APIC_HEADER_DEF
+       u8                              io_sapic_id;            /* I/O SAPIC ID */
+       u8                              reserved;               /* Reserved - must be zero */
+       u32                             interrupt_base;         /* Glocal interrupt for SAPIC start */
+       u64                             address;                /* SAPIC physical address */
+};
+
+struct madt_local_sapic
+{
+       APIC_HEADER_DEF
+       u8                              processor_id;           /* ACPI processor id */
+       u8                              local_sapic_id;         /* SAPIC ID */
+       u8                              local_sapic_eid;        /* SAPIC EID */
+       u8                              reserved [3];           /* Reserved - must be zero */
+       LOCAL_APIC_FLAGS
+};
+
+struct madt_interrupt_source
+{
+       APIC_HEADER_DEF
+       MPS_INTI_FLAGS
+       u8                              interrupt_type;         /* 1=PMI, 2=INIT, 3=corrected */
+       u8                              processor_id;           /* Processor ID */
+       u8                              processor_eid;          /* Processor EID */
+       u8                              io_sapic_vector;        /* Vector value for PMI interrupts */
+       u32                             interrupt;              /* Global system interrupt */
+       u32                             reserved;               /* Reserved - must be zero */
+};
+
+
+/*
+ * Smart Battery
+ */
+struct smart_battery_table
+{
+       ACPI_TABLE_HEADER_DEF
+       u32                             warning_level;
+       u32                             low_level;
+       u32                             critical_level;
+};
+
+
+/*
+ * High performance timer
+ */
+struct hpet_table
+{
+       ACPI_TABLE_HEADER_DEF
+       u32                             hardware_id;
+       u32                             base_address [3];
+       u8                              hpet_number;
+       u16                             clock_tick;
+       u8                              attributes;
+};
+
+#pragma pack()
+
+
+/*
+ * ACPI Table information.  We save the table address, length,
+ * and type of memory allocation (mapped or allocated) for each
+ * table for 1) when we exit, and 2) if a new table is installed
+ */
+#define ACPI_MEM_NOT_ALLOCATED  0
+#define ACPI_MEM_ALLOCATED      1
+#define ACPI_MEM_MAPPED         2
+
+/* Definitions for the Flags bitfield member of struct acpi_table_support */
+
+#define ACPI_TABLE_SINGLE       0x00
+#define ACPI_TABLE_MULTIPLE     0x01
+#define ACPI_TABLE_EXECUTABLE   0x02
+
+#define ACPI_TABLE_ROOT         0x00
+#define ACPI_TABLE_PRIMARY      0x10
+#define ACPI_TABLE_SECONDARY    0x20
+#define ACPI_TABLE_ALL          0x30
+#define ACPI_TABLE_TYPE_MASK    0x30
+
+/* Data about each known table type */
+
+struct acpi_table_support
+{
+       char                            *name;
+       char                            *signature;
+       void                            **global_ptr;
+       u8                              sig_length;
+       u8                              flags;
+};
+
+
+/*
+ * Get the ACPI version-specific tables
+ */
+#include "actbl1.h"   /* Acpi 1.0 table definitions */
+#include "actbl2.h"   /* Acpi 2.0 table definitions */
+
+
+#endif /* __ACTBL_H__ */
diff --git a/xen/include/acpi/actbl1.h b/xen/include/acpi/actbl1.h
new file mode 100644 (file)
index 0000000..0db07c3
--- /dev/null
@@ -0,0 +1,136 @@
+/******************************************************************************
+ *
+ * Name: actbl1.h - ACPI 1.0 tables
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACTBL1_H__
+#define __ACTBL1_H__
+
+#pragma pack(1)
+
+/*
+ * ACPI 1.0 Root System Description Table (RSDT)
+ */
+struct rsdt_descriptor_rev1
+{
+       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
+       u32                             table_offset_entry [1]; /* Array of pointers to other */
+                        /* ACPI tables */
+};
+
+
+/*
+ * ACPI 1.0 Firmware ACPI Control Structure (FACS)
+ */
+struct facs_descriptor_rev1
+{
+       char                            signature[4];           /* ACPI Signature */
+       u32                             length;                 /* Length of structure, in bytes */
+       u32                             hardware_signature;     /* Hardware configuration signature */
+       u32                             firmware_waking_vector; /* ACPI OS waking vector */
+       u32                             global_lock;            /* Global Lock */
+       u32                             S4bios_f        : 1;    /* Indicates if S4BIOS support is present */
+       u32                             reserved1       : 31;   /* Must be 0 */
+       u8                              resverved3 [40];        /* Reserved - must be zero */
+};
+
+
+/*
+ * ACPI 1.0 Fixed ACPI Description Table (FADT)
+ */
+struct fadt_descriptor_rev1
+{
+       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
+       u32                             firmware_ctrl;          /* Physical address of FACS */
+       u32                             dsdt;                   /* Physical address of DSDT */
+       u8                              model;                  /* System Interrupt Model */
+       u8                              reserved1;              /* Reserved */
+       u16                             sci_int;                /* System vector of SCI interrupt */
+       u32                             smi_cmd;                /* Port address of SMI command port */
+       u8                              acpi_enable;            /* Value to write to smi_cmd to enable ACPI */
+       u8                              acpi_disable;           /* Value to write to smi_cmd to disable ACPI */
+       u8                              S4bios_req;             /* Value to write to SMI CMD to enter S4BIOS state */
+       u8                              reserved2;              /* Reserved - must be zero */
+       u32                             pm1a_evt_blk;           /* Port address of Power Mgt 1a acpi_event Reg Blk */
+       u32                             pm1b_evt_blk;           /* Port address of Power Mgt 1b acpi_event Reg Blk */
+       u32                             pm1a_cnt_blk;           /* Port address of Power Mgt 1a Control Reg Blk */
+       u32                             pm1b_cnt_blk;           /* Port address of Power Mgt 1b Control Reg Blk */
+       u32                             pm2_cnt_blk;            /* Port address of Power Mgt 2 Control Reg Blk */
+       u32                             pm_tmr_blk;             /* Port address of Power Mgt Timer Ctrl Reg Blk */
+       u32                             gpe0_blk;               /* Port addr of General Purpose acpi_event 0 Reg Blk */
+       u32                             gpe1_blk;               /* Port addr of General Purpose acpi_event 1 Reg Blk */
+       u8                              pm1_evt_len;            /* Byte length of ports at pm1_x_evt_blk */
+       u8                              pm1_cnt_len;            /* Byte length of ports at pm1_x_cnt_blk */
+       u8                              pm2_cnt_len;            /* Byte Length of ports at pm2_cnt_blk */
+       u8                              pm_tm_len;              /* Byte Length of ports at pm_tm_blk */
+       u8                              gpe0_blk_len;           /* Byte Length of ports at gpe0_blk */
+       u8                              gpe1_blk_len;           /* Byte Length of ports at gpe1_blk */
+       u8                              gpe1_base;              /* Offset in gpe model where gpe1 events start */
+       u8                              reserved3;              /* Reserved */
+       u16                             plvl2_lat;              /* Worst case HW latency to enter/exit C2 state */
+       u16                             plvl3_lat;              /* Worst case HW latency to enter/exit C3 state */
+       u16                             flush_size;             /* Size of area read to flush caches */
+       u16                             flush_stride;           /* Stride used in flushing caches */
+       u8                              duty_offset;            /* Bit location of duty cycle field in p_cnt reg */
+       u8                              duty_width;             /* Bit width of duty cycle field in p_cnt reg */
+       u8                              day_alrm;               /* Index to day-of-month alarm in RTC CMOS RAM */
+       u8                              mon_alrm;               /* Index to month-of-year alarm in RTC CMOS RAM */
+       u8                              century;                /* Index to century in RTC CMOS RAM */
+       u8                              reserved4;              /* Reserved */
+       u8                              reserved4a;             /* Reserved */
+       u8                              reserved4b;             /* Reserved */
+       u32                             wb_invd         : 1;    /* The wbinvd instruction works properly */
+       u32                             wb_invd_flush   : 1;    /* The wbinvd flushes but does not invalidate */
+       u32                             proc_c1         : 1;    /* All processors support C1 state */
+       u32                             plvl2_up        : 1;    /* C2 state works on MP system */
+       u32                             pwr_button      : 1;    /* Power button is handled as a generic feature */
+       u32                             sleep_button    : 1;    /* Sleep button is handled as a generic feature, or not present */
+       u32                             fixed_rTC       : 1;    /* RTC wakeup stat not in fixed register space */
+       u32                             rtcs4           : 1;    /* RTC wakeup stat not possible from S4 */
+       u32                             tmr_val_ext     : 1;    /* The tmr_val width is 32 bits (0 = 24 bits) */
+       u32                             reserved5       : 23;   /* Reserved - must be zero */
+};
+
+#pragma pack()
+
+#endif /* __ACTBL1_H__ */
+
+
diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h
new file mode 100644 (file)
index 0000000..188cedb
--- /dev/null
@@ -0,0 +1,214 @@
+/******************************************************************************
+ *
+ * Name: actbl2.h - ACPI Specification Revision 2.0 Tables
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACTBL2_H__
+#define __ACTBL2_H__
+
+/*
+ * Prefered Power Management Profiles
+ */
+#define PM_UNSPECIFIED                  0
+#define PM_DESKTOP                      1
+#define PM_MOBILE                       2
+#define PM_WORKSTATION                  3
+#define PM_ENTERPRISE_SERVER            4
+#define PM_SOHO_SERVER                  5
+#define PM_APPLIANCE_PC                 6
+
+/*
+ * ACPI Boot Arch Flags
+ */
+#define BAF_LEGACY_DEVICES              0x0001
+#define BAF_8042_KEYBOARD_CONTROLLER    0x0002
+
+#define FADT2_REVISION_ID               3
+
+
+#pragma pack(1)
+
+/*
+ * ACPI 2.0 Root System Description Table (RSDT)
+ */
+struct rsdt_descriptor_rev2
+{
+       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
+       u32                             table_offset_entry [1]; /* Array of pointers to  */
+                        /* ACPI table headers */
+};
+
+
+/*
+ * ACPI 2.0 Extended System Description Table (XSDT)
+ */
+struct xsdt_descriptor_rev2
+{
+       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
+       u64                             table_offset_entry [1]; /* Array of pointers to  */
+                        /* ACPI table headers */
+};
+
+
+/*
+ * ACPI 2.0 Firmware ACPI Control Structure (FACS)
+ */
+struct facs_descriptor_rev2
+{
+       char                            signature[4];           /* ACPI signature */
+       u32                             length;                 /* Length of structure, in bytes */
+       u32                             hardware_signature;     /* Hardware configuration signature */
+       u32                             firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */
+       u32                             global_lock;            /* Global Lock used to synchronize access to shared hardware resources */
+       u32                             S4bios_f        : 1;    /* S4Bios_f - Indicates if S4BIOS support is present */
+       u32                             reserved1       : 31;   /* Must be 0 */
+       u64                             xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */
+       u8                              version;                /* Version of this table */
+       u8                              reserved3 [31];         /* Reserved - must be zero */
+};
+
+
+/*
+ * ACPI 2.0 Generic Address Structure (GAS)
+ */
+struct acpi_generic_address
+{
+       u8                              address_space_id;       /* Address space where struct or register exists. */
+       u8                              register_bit_width;     /* Size in bits of given register */
+       u8                              register_bit_offset;    /* Bit offset within the register */
+       u8                              reserved;               /* Must be 0 */
+       u64                             address;                /* 64-bit address of struct or register */
+};
+
+
+/*
+ * ACPI 2.0 Fixed ACPI Description Table (FADT)
+ */
+struct fadt_descriptor_rev2
+{
+       ACPI_TABLE_HEADER_DEF                       /* ACPI common table header */
+       u32                             V1_firmware_ctrl;   /* 32-bit physical address of FACS */
+       u32                             V1_dsdt;            /* 32-bit physical address of DSDT */
+       u8                              reserved1;          /* System Interrupt Model isn't used in ACPI 2.0*/
+       u8                              prefer_PM_profile;  /* Conveys preferred power management profile to OSPM. */
+       u16                             sci_int;            /* System vector of SCI interrupt */
+       u32                             smi_cmd;            /* Port address of SMI command port */
+       u8                              acpi_enable;        /* Value to write to smi_cmd to enable ACPI */
+       u8                              acpi_disable;       /* Value to write to smi_cmd to disable ACPI */
+       u8                              S4bios_req;         /* Value to write to SMI CMD to enter S4BIOS state */
+       u8                              pstate_cnt;         /* Processor performance state control*/
+       u32                             V1_pm1a_evt_blk;    /* Port address of Power Mgt 1a acpi_event Reg Blk */
+       u32                             V1_pm1b_evt_blk;    /* Port address of Power Mgt 1b acpi_event Reg Blk */
+       u32                             V1_pm1a_cnt_blk;    /* Port address of Power Mgt 1a Control Reg Blk */
+       u32                             V1_pm1b_cnt_blk;    /* Port address of Power Mgt 1b Control Reg Blk */
+       u32                             V1_pm2_cnt_blk;     /* Port address of Power Mgt 2 Control Reg Blk */
+       u32                             V1_pm_tmr_blk;      /* Port address of Power Mgt Timer Ctrl Reg Blk */
+       u32                             V1_gpe0_blk;        /* Port addr of General Purpose acpi_event 0 Reg Blk */
+       u32                             V1_gpe1_blk;        /* Port addr of General Purpose acpi_event 1 Reg Blk */
+       u8                              pm1_evt_len;        /* Byte length of ports at pm1_x_evt_blk */
+       u8                              pm1_cnt_len;        /* Byte length of ports at pm1_x_cnt_blk */
+       u8                              pm2_cnt_len;        /* Byte Length of ports at pm2_cnt_blk */
+       u8                              pm_tm_len;          /* Byte Length of ports at pm_tm_blk */
+       u8                              gpe0_blk_len;       /* Byte Length of ports at gpe0_blk */
+       u8                              gpe1_blk_len;       /* Byte Length of ports at gpe1_blk */
+       u8                              gpe1_base;          /* Offset in gpe model where gpe1 events start */
+       u8                              cst_cnt;            /* Support for the _CST object and C States change notification.*/
+       u16                             plvl2_lat;          /* Worst case HW latency to enter/exit C2 state */
+       u16                             plvl3_lat;          /* Worst case HW latency to enter/exit C3 state */
+       u16                             flush_size;         /* Number of flush strides that need to be read */
+       u16                             flush_stride;       /* Processor's memory cache line width, in bytes */
+       u8                              duty_offset;        /* Processor's duty cycle index in processor's P_CNT reg*/
+       u8                              duty_width;         /* Processor's duty cycle value bit width in P_CNT register.*/
+       u8                              day_alrm;           /* Index to day-of-month alarm in RTC CMOS RAM */
+       u8                              mon_alrm;           /* Index to month-of-year alarm in RTC CMOS RAM */
+       u8                              century;            /* Index to century in RTC CMOS RAM */
+       u16                             iapc_boot_arch;     /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
+       u8                              reserved2;          /* Reserved */
+       u32                             wb_invd     : 1;    /* The wbinvd instruction works properly */
+       u32                             wb_invd_flush : 1;  /* The wbinvd flushes but does not invalidate */
+       u32                             proc_c1     : 1;    /* All processors support C1 state */
+       u32                             plvl2_up    : 1;    /* C2 state works on MP system */
+       u32                             pwr_button  : 1;    /* Power button is handled as a generic feature */
+       u32                             sleep_button : 1;   /* Sleep button is handled as a generic feature, or not present */
+       u32                             fixed_rTC   : 1;    /* RTC wakeup stat not in fixed register space */
+       u32                             rtcs4       : 1;    /* RTC wakeup stat not possible from S4 */
+       u32                             tmr_val_ext : 1;    /* Indicates tmr_val is 32 bits 0=24-bits*/
+       u32                             dock_cap    : 1;    /* Supports Docking */
+       u32                             reset_reg_sup : 1;  /* Indicates system supports system reset via the FADT RESET_REG*/
+       u32                             sealed_case : 1;    /* Indicates system has no internal expansion capabilities and case is sealed. */
+       u32                             headless    : 1;    /* Indicates system does not have local video capabilities or local input devices.*/
+       u32                             cpu_sw_sleep : 1;   /* Indicates to OSPM that a processor native instruction */
+                          /* Must be executed after writing the SLP_TYPx register. */
+       u32                             reserved6   : 18;   /* Reserved - must be zero */
+
+       struct acpi_generic_address     reset_register;     /* Reset register address in GAS format */
+       u8                              reset_value;        /* Value to write to the reset_register port to reset the system. */
+       u8                              reserved7[3];       /* These three bytes must be zero */
+       u64                             xfirmware_ctrl;     /* 64-bit physical address of FACS */
+       u64                             Xdsdt;              /* 64-bit physical address of DSDT */
+       struct acpi_generic_address     xpm1a_evt_blk;      /* Extended Power Mgt 1a acpi_event Reg Blk address */
+       struct acpi_generic_address     xpm1b_evt_blk;      /* Extended Power Mgt 1b acpi_event Reg Blk address */
+       struct acpi_generic_address     xpm1a_cnt_blk;      /* Extended Power Mgt 1a Control Reg Blk address */
+       struct acpi_generic_address     xpm1b_cnt_blk;      /* Extended Power Mgt 1b Control Reg Blk address */
+       struct acpi_generic_address     xpm2_cnt_blk;       /* Extended Power Mgt 2 Control Reg Blk address */
+       struct acpi_generic_address     xpm_tmr_blk;        /* Extended Power Mgt Timer Ctrl Reg Blk address */
+       struct acpi_generic_address     xgpe0_blk;          /* Extended General Purpose acpi_event 0 Reg Blk address */
+       struct acpi_generic_address     xgpe1_blk;          /* Extended General Purpose acpi_event 1 Reg Blk address */
+};
+
+
+/* Embedded Controller */
+
+struct ec_boot_resources
+{
+       ACPI_TABLE_HEADER_DEF
+       struct acpi_generic_address     ec_control;         /* Address of EC command/status register */
+       struct acpi_generic_address     ec_data;            /* Address of EC data register */
+       u32                             uid;                /* Unique ID - must be same as the EC _UID method */
+       u8                              gpe_bit;            /* The GPE for the EC */
+       u8                              ec_id[1];           /* Full namepath of the EC in the ACPI namespace */
+};
+
+
+#pragma pack()
+
+#endif /* __ACTBL2_H__ */
+
diff --git a/xen/include/acpi/actbl71.h b/xen/include/acpi/actbl71.h
new file mode 100644 (file)
index 0000000..7b4fb44
--- /dev/null
@@ -0,0 +1,144 @@
+/******************************************************************************
+ *
+ * Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71
+ *                   This file includes tables specific to this
+ *                   specification revision.
+ *
+ *****************************************************************************/
+
+/*
+ *  Copyright (C) 2000 - 2003, R. Byron Moore
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __ACTBL71_H__
+#define __ACTBL71_H__
+
+
+/* 0.71 FADT address_space data item bitmasks defines */
+/* If the associated bit is zero then it is in memory space else in io space */
+
+#define SMI_CMD_ADDRESS_SPACE       0x01
+#define PM1_BLK_ADDRESS_SPACE       0x02
+#define PM2_CNT_BLK_ADDRESS_SPACE   0x04
+#define PM_TMR_BLK_ADDRESS_SPACE    0x08
+#define GPE0_BLK_ADDRESS_SPACE      0x10
+#define GPE1_BLK_ADDRESS_SPACE      0x20
+
+/* Only for clarity in declarations */
+
+typedef u64                         IO_ADDRESS;
+
+
+#pragma pack(1)
+struct  /* Root System Descriptor Pointer */
+{
+       NATIVE_CHAR             signature [8];          /* contains "RSD PTR " */
+       u8                              checksum;               /* to make sum of struct == 0 */
+       NATIVE_CHAR             oem_id [6];             /* OEM identification */
+       u8                              reserved;               /* Must be 0 for 1.0, 2 for 2.0 */
+       u64                             rsdt_physical_address;  /* 64-bit physical address of RSDT */
+};
+
+
+/*****************************************/
+/* IA64 Extensions to ACPI Spec Rev 0.71 */
+/* for the Root System Description Table */
+/*****************************************/
+struct
+{
+       struct acpi_table_header    header;                 /* Table header */
+       u32                         reserved_pad;           /* IA64 alignment, must be 0 */
+       u64                         table_offset_entry [1]; /* Array of pointers to other */
+                          /* tables' headers */
+};
+
+
+/*******************************************/
+/* IA64 Extensions to ACPI Spec Rev 0.71   */
+/* for the Firmware ACPI Control Structure */
+/*******************************************/
+struct
+{
+       NATIVE_CHAR         signature[4];         /* signature "FACS" */
+       u32                         length;               /* length of structure, in bytes */
+       u32                         hardware_signature;   /* hardware configuration signature */
+       u32                         reserved4;            /* must be 0 */
+       u64                         firmware_waking_vector; /* ACPI OS waking vector */
+       u64                         global_lock;          /* Global Lock */
+       u32                         S4bios_f      : 1;    /* Indicates if S4BIOS support is present */
+       u32                         reserved1     : 31;   /* must be 0 */
+       u8                          reserved3 [28];       /* reserved - must be zero */
+};
+
+
+/******************************************/
+/* IA64 Extensions to ACPI Spec Rev 0.71  */
+/* for the Fixed ACPI Description Table   */
+/******************************************/
+struct
+{
+       struct acpi_table_header    header;             /* table header */
+       u32                         reserved_pad;       /* IA64 alignment, must be 0 */
+       u64                         firmware_ctrl;      /* 64-bit Physical address of FACS */
+       u64                         dsdt;               /* 64-bit Physical address of DSDT */
+       u8                          model;              /* System Interrupt Model */
+       u8                          address_space;      /* Address Space Bitmask */
+       u16                         sci_int;            /* System vector of SCI interrupt */
+       u8                          acpi_enable;        /* value to write to smi_cmd to enable ACPI */
+       u8                          acpi_disable;       /* value to write to smi_cmd to disable ACPI */
+       u8                          S4bios_req;         /* Value to write to SMI CMD to enter S4BIOS state */
+       u8                          reserved2;          /* reserved - must be zero */
+       u64                         smi_cmd;            /* Port address of SMI command port */
+       u64                         pm1a_evt_blk;       /* Port address of Power Mgt 1a acpi_event Reg Blk */
+       u64                         pm1b_evt_blk;       /* Port address of Power Mgt 1b acpi_event Reg Blk */
+       u64                         pm1a_cnt_blk;       /* Port address of Power Mgt 1a Control Reg Blk */
+       u64                         pm1b_cnt_blk;       /* Port address of Power Mgt 1b Control Reg Blk */
+       u64                         pm2_cnt_blk;        /* Port address of Power Mgt 2 Control Reg Blk */
+       u64                         pm_tmr_blk;         /* Port address of Power Mgt Timer Ctrl Reg Blk */
+       u64                         gpe0_blk;           /* Port addr of General Purpose acpi_event 0 Reg Blk */
+       u64                         gpe1_blk;           /* Port addr of General Purpose acpi_event 1 Reg Blk */
+       u8                          pm1_evt_len;        /* Byte length of ports at pm1_x_evt_blk */
+       u8                          pm1_cnt_len;        /* Byte length of ports at pm1_x_cnt_blk */
+       u8                          pm2_cnt_len;        /* Byte Length of ports at pm2_cnt_blk */
+       u8                          pm_tm_len;          /* Byte Length of ports at pm_tm_blk */
+       u8                          gpe0_blk_len;       /* Byte Length of ports at gpe0_blk */
+       u8                          gpe1_blk_len;       /* Byte Length of ports at gpe1_blk */
+       u8                          gpe1_base;          /* offset in gpe model where gpe1 events start */
+       u8                          reserved3;          /* reserved */
+       u16                         plvl2_lat;          /* worst case HW latency to enter/exit C2 state */
+       u16                         plvl3_lat;          /* worst case HW latency to enter/exit C3 state */
+       u8                          day_alrm;           /* index to day-of-month alarm in RTC CMOS RAM */
+       u8                          mon_alrm;           /* index to month-of-year alarm in RTC CMOS RAM */
+       u8                          century;            /* index to century in RTC CMOS RAM */
+       u8                          reserved4;          /* reserved */
+       u32                         flush_cash  : 1;    /* PAL_FLUSH_CACHE is correctly supported */
+       u32                         reserved5   : 1;    /* reserved - must be zero */
+       u32                         proc_c1     : 1;    /* all processors support C1 state */
+       u32                         plvl2_up    : 1;    /* C2 state works on MP system */
+       u32                         pwr_button  : 1;    /* Power button is handled as a generic feature */
+       u32                         sleep_button : 1;   /* Sleep button is handled as a generic feature, or not present */
+       u32                         fixed_rTC   : 1;    /* RTC wakeup stat not in fixed register space */
+       u32                         rtcs4       : 1;    /* RTC wakeup stat not possible from S4 */
+       u32                         tmr_val_ext : 1;    /* tmr_val is 32 bits */
+       u32                         dock_cap    : 1;    /* Supports Docking */
+       u32                         reserved6   : 22;    /* reserved - must be zero */
+};
+
+#pragma pack()
+
+#endif /* __ACTBL71_H__ */
+
diff --git a/xen/include/acpi/actypes.h b/xen/include/acpi/actypes.h
new file mode 100644 (file)
index 0000000..ae1a73e
--- /dev/null
@@ -0,0 +1,1248 @@
+/******************************************************************************
+ *
+ * Name: actypes.h - Common data types for the entire ACPI subsystem
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACTYPES_H__
+#define __ACTYPES_H__
+
+/*! [Begin] no source code translation (keep the typedefs) */
+
+
+
+/*
+ * Data type ranges
+ * Note: These macros are designed to be compiler independent as well as
+ * working around problems that some 32-bit compilers have with 64-bit
+ * constants.
+ */
+#define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0)) /* 0xFF               */
+#define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0)) /* 0xFFFF             */
+#define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF         */
+#define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
+#define ACPI_ASCII_MAX                  0x7F
+
+
+#ifdef DEFINE_ALTERNATE_TYPES
+/*
+ * Types used only in translated source, defined here to enable
+ * cross-platform compilation only.
+ */
+typedef int                             s32;
+typedef unsigned char                   u8;
+typedef unsigned short                  u16;
+typedef unsigned int                    u32;
+typedef COMPILER_DEPENDENT_UINT64       u64;
+
+#endif
+
+
+/*
+ * Data types - Fixed across all compilation models (16/32/64)
+ *
+ * BOOLEAN          Logical Boolean.
+ * INT8             8-bit  (1 byte) signed value
+ * UINT8            8-bit  (1 byte) unsigned value
+ * INT16            16-bit (2 byte) signed value
+ * UINT16           16-bit (2 byte) unsigned value
+ * INT32            32-bit (4 byte) signed value
+ * UINT32           32-bit (4 byte) unsigned value
+ * INT64            64-bit (8 byte) signed value
+ * UINT64           64-bit (8 byte) unsigned value
+ * ACPI_NATIVE_INT  32-bit on IA-32, 64-bit on IA-64 signed value
+ * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
+ */
+
+#ifndef ACPI_MACHINE_WIDTH
+#error ACPI_MACHINE_WIDTH not defined
+#endif
+
+#if ACPI_MACHINE_WIDTH == 64
+
+/*! [Begin] no source code translation (keep the typedefs) */
+
+/*
+ * 64-bit type definitions
+ */
+typedef unsigned char                   UINT8;
+typedef unsigned char                   BOOLEAN;
+typedef unsigned short                  UINT16;
+typedef int                             INT32;
+typedef unsigned int                    UINT32;
+typedef COMPILER_DEPENDENT_INT64        INT64;
+typedef COMPILER_DEPENDENT_UINT64       UINT64;
+
+/*! [End] no source code translation !*/
+
+typedef s64                                     acpi_native_int;
+typedef u64                                     acpi_native_uint;
+
+typedef u64                                     acpi_table_ptr;
+typedef u64                                     acpi_io_address;
+typedef u64                                     acpi_physical_address;
+typedef u64                                     acpi_size;
+
+#define ALIGNED_ADDRESS_BOUNDARY        0x00000008      /* No hardware alignment support in IA64 */
+#define ACPI_USE_NATIVE_DIVIDE                          /* Native 64-bit integer support */
+#define ACPI_MAX_PTR                    ACPI_UINT64_MAX
+#define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
+
+
+#elif ACPI_MACHINE_WIDTH == 16
+
+/*! [Begin] no source code translation (keep the typedefs) */
+
+/*
+ * 16-bit type definitions
+ */
+typedef unsigned char                   UINT8;
+typedef unsigned char                   BOOLEAN;
+typedef unsigned int                    UINT16;
+typedef long                            INT32;
+typedef int                             INT16;
+typedef unsigned long                   UINT32;
+
+struct
+{
+       UINT32                                  Lo;
+       UINT32                                  Hi;
+};
+
+/*! [End] no source code translation !*/
+
+typedef u16                                     acpi_native_uint;
+typedef s16                                     acpi_native_int;
+
+typedef u32                                     acpi_table_ptr;
+typedef u32                                     acpi_io_address;
+typedef char                                    *acpi_physical_address;
+typedef u16                                     acpi_size;
+
+#define ALIGNED_ADDRESS_BOUNDARY        0x00000002
+#define ACPI_MISALIGNED_TRANSFERS
+#define ACPI_USE_NATIVE_DIVIDE                          /* No 64-bit integers, ok to use native divide */
+#define ACPI_MAX_PTR                    ACPI_UINT16_MAX
+#define ACPI_SIZE_MAX                   ACPI_UINT16_MAX
+
+/*
+ * (16-bit only) internal integers must be 32-bits, so
+ * 64-bit integers cannot be supported
+ */
+#define ACPI_NO_INTEGER64_SUPPORT
+
+
+#elif ACPI_MACHINE_WIDTH == 32
+
+/*! [Begin] no source code translation (keep the typedefs) */
+
+/*
+ * 32-bit type definitions (default)
+ */
+typedef unsigned char                   UINT8;
+typedef unsigned char                   BOOLEAN;
+typedef unsigned short                  UINT16;
+typedef int                             INT32;
+typedef unsigned int                    UINT32;
+typedef COMPILER_DEPENDENT_INT64        INT64;
+typedef COMPILER_DEPENDENT_UINT64       UINT64;
+
+/*! [End] no source code translation !*/
+
+typedef s32                                     acpi_native_int;
+typedef u32                                     acpi_native_uint;
+
+typedef u64                                     acpi_table_ptr;
+typedef u32                                     acpi_io_address;
+typedef u64                                     acpi_physical_address;
+typedef u32                                     acpi_size;
+
+#define ALIGNED_ADDRESS_BOUNDARY        0x00000004
+#define ACPI_MISALIGNED_TRANSFERS
+#define ACPI_MAX_PTR                    ACPI_UINT32_MAX
+#define ACPI_SIZE_MAX                   ACPI_UINT32_MAX
+
+#else
+#error unknown ACPI_MACHINE_WIDTH
+#endif
+
+
+/*
+ * Miscellaneous common types
+ */
+typedef u16                                     UINT16_BIT;
+typedef u32                                     UINT32_BIT;
+typedef acpi_native_uint                        ACPI_PTRDIFF;
+
+/*
+ * Pointer overlays to avoid lots of typecasting for
+ * code that accepts both physical and logical pointers.
+ */
+union acpi_pointers
+{
+       acpi_physical_address               physical;
+       void                                *logical;
+       acpi_table_ptr                      value;
+};
+
+struct acpi_pointer
+{
+       u32                                 pointer_type;
+       union acpi_pointers                 pointer;
+};
+
+/* pointer_types for above */
+
+#define ACPI_PHYSICAL_POINTER           0x01
+#define ACPI_LOGICAL_POINTER            0x02
+
+/* Processor mode */
+
+#define ACPI_PHYSICAL_ADDRESSING        0x04
+#define ACPI_LOGICAL_ADDRESSING         0x08
+#define ACPI_MEMORY_MODE                0x0C
+
+#define ACPI_PHYSMODE_PHYSPTR           ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
+#define ACPI_LOGMODE_PHYSPTR            ACPI_LOGICAL_ADDRESSING  | ACPI_PHYSICAL_POINTER
+#define ACPI_LOGMODE_LOGPTR             ACPI_LOGICAL_ADDRESSING  | ACPI_LOGICAL_POINTER
+
+
+/*
+ * Useful defines
+ */
+#ifdef FALSE
+#undef FALSE
+#endif
+#define FALSE                           (1 == 0)
+
+#ifdef TRUE
+#undef TRUE
+#endif
+#define TRUE                            (1 == 1)
+
+#ifndef NULL
+#define NULL                            (void *) 0
+#endif
+
+
+/*
+ * Local datatypes
+ */
+typedef u32                                     acpi_status;    /* All ACPI Exceptions */
+typedef u32                                     acpi_name;      /* 4-byte ACPI name */
+typedef char *                                  acpi_string;    /* Null terminated ASCII string */
+typedef void *                                  acpi_handle;    /* Actually a ptr to an Node */
+
+struct uint64_struct
+{
+       u32                                 lo;
+       u32                                 hi;
+};
+
+union uint64_overlay
+{
+       u64                                 full;
+       struct uint64_struct                part;
+};
+
+struct uint32_struct
+{
+       u32                                 lo;
+       u32                                 hi;
+};
+
+
+/*
+ * Acpi integer width. In ACPI version 1, integers are
+ * 32 bits.  In ACPI version 2, integers are 64 bits.
+ * Note that this pertains to the ACPI integer type only, not
+ * other integers used in the implementation of the ACPI CA
+ * subsystem.
+ */
+#ifdef ACPI_NO_INTEGER64_SUPPORT
+
+/* 32-bit integers only, no 64-bit support */
+
+typedef u32                                     acpi_integer;
+#define ACPI_INTEGER_MAX                ACPI_UINT32_MAX
+#define ACPI_INTEGER_BIT_SIZE           32
+#define ACPI_MAX_DECIMAL_DIGITS         10
+
+#define ACPI_USE_NATIVE_DIVIDE          /* Use compiler native 32-bit divide */
+
+
+#else
+
+/* 64-bit integers */
+
+typedef u64                                     acpi_integer;
+#define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
+#define ACPI_INTEGER_BIT_SIZE           64
+#define ACPI_MAX_DECIMAL_DIGITS         19
+
+#if ACPI_MACHINE_WIDTH == 64
+#define ACPI_USE_NATIVE_DIVIDE          /* Use compiler native 64-bit divide */
+#endif
+#endif
+
+
+/*
+ * Constants with special meanings
+ */
+#define ACPI_ROOT_OBJECT                (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
+
+
+/*
+ * Initialization sequence
+ */
+#define ACPI_FULL_INITIALIZATION        0x00
+#define ACPI_NO_ADDRESS_SPACE_INIT      0x01
+#define ACPI_NO_HARDWARE_INIT           0x02
+#define ACPI_NO_EVENT_INIT              0x04
+#define ACPI_NO_HANDLER_INIT            0x08
+#define ACPI_NO_ACPI_ENABLE             0x10
+#define ACPI_NO_DEVICE_INIT             0x20
+#define ACPI_NO_OBJECT_INIT             0x40
+
+/*
+ * Initialization state
+ */
+#define ACPI_INITIALIZED_OK             0x01
+
+/*
+ * Power state values
+ */
+
+#define ACPI_STATE_UNKNOWN              (u8) 0xFF
+
+#define ACPI_STATE_S0                   (u8) 0
+#define ACPI_STATE_S1                   (u8) 1
+#define ACPI_STATE_S2                   (u8) 2
+#define ACPI_STATE_S3                   (u8) 3
+#define ACPI_STATE_S4                   (u8) 4
+#define ACPI_STATE_S5                   (u8) 5
+#define ACPI_S_STATES_MAX               ACPI_STATE_S5
+#define ACPI_S_STATE_COUNT              6
+
+#define ACPI_STATE_D0                   (u8) 0
+#define ACPI_STATE_D1                   (u8) 1
+#define ACPI_STATE_D2                   (u8) 2
+#define ACPI_STATE_D3                   (u8) 3
+#define ACPI_D_STATES_MAX               ACPI_STATE_D3
+#define ACPI_D_STATE_COUNT              4
+
+#define ACPI_STATE_C0                   (u8) 0
+#define ACPI_STATE_C1                   (u8) 1
+#define ACPI_STATE_C2                   (u8) 2
+#define ACPI_STATE_C3                   (u8) 3
+#define ACPI_C_STATES_MAX               ACPI_STATE_C3
+#define ACPI_C_STATE_COUNT              4
+
+/*
+ * Sleep type invalid value
+ */
+#define ACPI_SLEEP_TYPE_MAX             0x7
+#define ACPI_SLEEP_TYPE_INVALID         0xFF
+
+/*
+ * Standard notify values
+ */
+#define ACPI_NOTIFY_BUS_CHECK           (u8) 0
+#define ACPI_NOTIFY_DEVICE_CHECK        (u8) 1
+#define ACPI_NOTIFY_DEVICE_WAKE         (u8) 2
+#define ACPI_NOTIFY_EJECT_REQUEST       (u8) 3
+#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (u8) 4
+#define ACPI_NOTIFY_FREQUENCY_MISMATCH  (u8) 5
+#define ACPI_NOTIFY_BUS_MODE_MISMATCH   (u8) 6
+#define ACPI_NOTIFY_POWER_FAULT         (u8) 7
+
+
+/*
+ *  Table types.  These values are passed to the table related APIs
+ */
+typedef u32                                     acpi_table_type;
+
+#define ACPI_TABLE_RSDP                 (acpi_table_type) 0
+#define ACPI_TABLE_DSDT                 (acpi_table_type) 1
+#define ACPI_TABLE_FADT                 (acpi_table_type) 2
+#define ACPI_TABLE_FACS                 (acpi_table_type) 3
+#define ACPI_TABLE_PSDT                 (acpi_table_type) 4
+#define ACPI_TABLE_SSDT                 (acpi_table_type) 5
+#define ACPI_TABLE_XSDT                 (acpi_table_type) 6
+#define ACPI_TABLE_MAX                  6
+#define NUM_ACPI_TABLE_TYPES            (ACPI_TABLE_MAX+1)
+
+
+/*
+ * Types associated with ACPI names and objects.  The first group of
+ * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
+ * of the ACPI object_type() operator (See the ACPI Spec). Therefore,
+ * only add to the first group if the spec changes.
+ *
+ * Types must be kept in sync with the global acpi_ns_properties
+ * and acpi_ns_type_names arrays.
+ */
+typedef u32                                     acpi_object_type;
+
+#define ACPI_TYPE_ANY                   0x00
+#define ACPI_TYPE_INTEGER               0x01  /* Byte/Word/Dword/Zero/One/Ones */
+#define ACPI_TYPE_STRING                0x02
+#define ACPI_TYPE_BUFFER                0x03
+#define ACPI_TYPE_PACKAGE               0x04  /* byte_const, multiple data_term/Constant/super_name */
+#define ACPI_TYPE_FIELD_UNIT            0x05
+#define ACPI_TYPE_DEVICE                0x06  /* Name, multiple Node */
+#define ACPI_TYPE_EVENT                 0x07
+#define ACPI_TYPE_METHOD                0x08  /* Name, byte_const, multiple Code */
+#define ACPI_TYPE_MUTEX                 0x09
+#define ACPI_TYPE_REGION                0x0A
+#define ACPI_TYPE_POWER                 0x0B  /* Name,byte_const,word_const,multi Node */
+#define ACPI_TYPE_PROCESSOR             0x0C  /* Name,byte_const,Dword_const,byte_const,multi nm_o */
+#define ACPI_TYPE_THERMAL               0x0D  /* Name, multiple Node */
+#define ACPI_TYPE_BUFFER_FIELD          0x0E
+#define ACPI_TYPE_DDB_HANDLE            0x0F
+#define ACPI_TYPE_DEBUG_OBJECT          0x10
+
+#define ACPI_TYPE_EXTERNAL_MAX          0x10
+
+/*
+ * These are object types that do not map directly to the ACPI
+ * object_type() operator. They are used for various internal purposes only.
+ * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
+ * internal types must move upwards. (There is code that depends on these
+ * values being contiguous with the external types above.)
+ */
+#define ACPI_TYPE_LOCAL_REGION_FIELD    0x11
+#define ACPI_TYPE_LOCAL_BANK_FIELD      0x12
+#define ACPI_TYPE_LOCAL_INDEX_FIELD     0x13
+#define ACPI_TYPE_LOCAL_REFERENCE       0x14  /* Arg#, Local#, Name, Debug, ref_of, Index */
+#define ACPI_TYPE_LOCAL_ALIAS           0x15
+#define ACPI_TYPE_LOCAL_NOTIFY          0x16
+#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x17
+#define ACPI_TYPE_LOCAL_RESOURCE        0x18
+#define ACPI_TYPE_LOCAL_RESOURCE_FIELD  0x19
+#define ACPI_TYPE_LOCAL_SCOPE           0x1A  /* 1 Name, multiple object_list Nodes */
+
+#define ACPI_TYPE_NS_NODE_MAX           0x1A  /* Last typecode used within a NS Node */
+
+/*
+ * These are special object types that never appear in
+ * a Namespace node, only in an union acpi_operand_object
+ */
+#define ACPI_TYPE_LOCAL_EXTRA           0x1B
+#define ACPI_TYPE_LOCAL_DATA            0x1C
+
+#define ACPI_TYPE_LOCAL_MAX             0x1C
+
+/* All types above here are invalid */
+
+#define ACPI_TYPE_INVALID               0x1D
+#define ACPI_TYPE_NOT_FOUND             0xFF
+
+
+/*
+ * Bitmapped ACPI types.  Used internally only
+ */
+#define ACPI_BTYPE_ANY                  0x00000000
+#define ACPI_BTYPE_INTEGER              0x00000001
+#define ACPI_BTYPE_STRING               0x00000002
+#define ACPI_BTYPE_BUFFER               0x00000004
+#define ACPI_BTYPE_PACKAGE              0x00000008
+#define ACPI_BTYPE_FIELD_UNIT           0x00000010
+#define ACPI_BTYPE_DEVICE               0x00000020
+#define ACPI_BTYPE_EVENT                0x00000040
+#define ACPI_BTYPE_METHOD               0x00000080
+#define ACPI_BTYPE_MUTEX                0x00000100
+#define ACPI_BTYPE_REGION               0x00000200
+#define ACPI_BTYPE_POWER                0x00000400
+#define ACPI_BTYPE_PROCESSOR            0x00000800
+#define ACPI_BTYPE_THERMAL              0x00001000
+#define ACPI_BTYPE_BUFFER_FIELD         0x00002000
+#define ACPI_BTYPE_DDB_HANDLE           0x00004000
+#define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
+#define ACPI_BTYPE_REFERENCE            0x00010000
+#define ACPI_BTYPE_RESOURCE             0x00020000
+
+#define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
+
+#define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
+#define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
+#define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
+#define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
+#define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
+
+/*
+ * All I/O
+ */
+#define ACPI_READ                       0
+#define ACPI_WRITE                      1
+#define ACPI_IO_MASK                    1
+
+
+/*
+ * Acpi Event Types: Fixed & General Purpose
+ */
+typedef u32                                     acpi_event_type;
+
+/*
+ * Fixed events
+ */
+#define ACPI_EVENT_PMTIMER              0
+#define ACPI_EVENT_GLOBAL               1
+#define ACPI_EVENT_POWER_BUTTON         2
+#define ACPI_EVENT_SLEEP_BUTTON         3
+#define ACPI_EVENT_RTC                  4
+#define ACPI_EVENT_MAX                  4
+#define ACPI_NUM_FIXED_EVENTS           ACPI_EVENT_MAX + 1
+
+#define ACPI_GPE_INVALID                0xFF
+#define ACPI_GPE_MAX                    0xFF
+#define ACPI_NUM_GPE                    256
+
+#define ACPI_EVENT_LEVEL_TRIGGERED      1
+#define ACPI_EVENT_EDGE_TRIGGERED       2
+
+/*
+ * Flags for GPE and Lock interfaces
+ */
+#define ACPI_EVENT_WAKE_ENABLE          0x2
+#define ACPI_EVENT_WAKE_DISABLE         0x2
+
+#define ACPI_NOT_ISR                    0x1
+#define ACPI_ISR                        0x0
+
+
+/*
+ * acpi_event Status:
+ * -------------
+ * The encoding of acpi_event_status is illustrated below.
+ * Note that a set bit (1) indicates the property is TRUE
+ * (e.g. if bit 0 is set then the event is enabled).
+ * +-------------+-+-+-+
+ * |   Bits 31:3 |2|1|0|
+ * +-------------+-+-+-+
+ *          |     | | |
+ *          |     | | +- Enabled?
+ *          |     | +--- Enabled for wake?
+ *          |     +----- Set?
+ *          +----------- <Reserved>
+ */
+typedef u32                                     acpi_event_status;
+
+#define ACPI_EVENT_FLAG_DISABLED        (acpi_event_status) 0x00
+#define ACPI_EVENT_FLAG_ENABLED         (acpi_event_status) 0x01
+#define ACPI_EVENT_FLAG_WAKE_ENABLED    (acpi_event_status) 0x02
+#define ACPI_EVENT_FLAG_SET             (acpi_event_status) 0x04
+
+
+/* Notify types */
+
+#define ACPI_SYSTEM_NOTIFY              0
+#define ACPI_DEVICE_NOTIFY              1
+#define ACPI_MAX_NOTIFY_HANDLER_TYPE    1
+
+#define ACPI_MAX_SYS_NOTIFY             0x7f
+
+
+/* Address Space (Operation Region) Types */
+
+typedef u8                                      acpi_adr_space_type;
+
+#define ACPI_ADR_SPACE_SYSTEM_MEMORY    (acpi_adr_space_type) 0
+#define ACPI_ADR_SPACE_SYSTEM_IO        (acpi_adr_space_type) 1
+#define ACPI_ADR_SPACE_PCI_CONFIG       (acpi_adr_space_type) 2
+#define ACPI_ADR_SPACE_EC               (acpi_adr_space_type) 3
+#define ACPI_ADR_SPACE_SMBUS            (acpi_adr_space_type) 4
+#define ACPI_ADR_SPACE_CMOS             (acpi_adr_space_type) 5
+#define ACPI_ADR_SPACE_PCI_BAR_TARGET   (acpi_adr_space_type) 6
+#define ACPI_ADR_SPACE_DATA_TABLE       (acpi_adr_space_type) 7
+#define ACPI_ADR_SPACE_FIXED_HARDWARE   (acpi_adr_space_type) 127
+
+
+/*
+ * bit_register IDs
+ * These are bitfields defined within the full ACPI registers
+ */
+#define ACPI_BITREG_TIMER_STATUS                0x00
+#define ACPI_BITREG_BUS_MASTER_STATUS           0x01
+#define ACPI_BITREG_GLOBAL_LOCK_STATUS          0x02
+#define ACPI_BITREG_POWER_BUTTON_STATUS         0x03
+#define ACPI_BITREG_SLEEP_BUTTON_STATUS         0x04
+#define ACPI_BITREG_RT_CLOCK_STATUS             0x05
+#define ACPI_BITREG_WAKE_STATUS                 0x06
+
+#define ACPI_BITREG_TIMER_ENABLE                0x07
+#define ACPI_BITREG_GLOBAL_LOCK_ENABLE          0x08
+#define ACPI_BITREG_POWER_BUTTON_ENABLE         0x09
+#define ACPI_BITREG_SLEEP_BUTTON_ENABLE         0x0A
+#define ACPI_BITREG_RT_CLOCK_ENABLE             0x0B
+#define ACPI_BITREG_WAKE_ENABLE                 0x0C
+
+#define ACPI_BITREG_SCI_ENABLE                  0x0D
+#define ACPI_BITREG_BUS_MASTER_RLD              0x0E
+#define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x0F
+#define ACPI_BITREG_SLEEP_TYPE_A                0x10
+#define ACPI_BITREG_SLEEP_TYPE_B                0x11
+#define ACPI_BITREG_SLEEP_ENABLE                0x12
+
+#define ACPI_BITREG_ARB_DISABLE                 0x13
+
+#define ACPI_BITREG_MAX                         0x13
+#define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
+
+
+/*
+ * External ACPI object definition
+ */
+union acpi_object
+{
+       acpi_object_type                    type;   /* See definition of acpi_ns_type for values */
+       struct
+       {
+               acpi_object_type                    type;
+               acpi_integer                        value;      /* The actual number */
+       } integer;
+
+       struct
+       {
+               acpi_object_type                    type;
+               u32                                 length;     /* # of bytes in string, excluding trailing null */
+               char                                *pointer;   /* points to the string value */
+       } string;
+
+       struct
+       {
+               acpi_object_type                    type;
+               u32                                 length;     /* # of bytes in buffer */
+               u8                                  *pointer;   /* points to the buffer */
+       } buffer;
+
+       struct
+       {
+               acpi_object_type                    type;
+               u32                                 fill1;
+               acpi_handle                         handle;     /* object reference */
+       } reference;
+
+       struct
+       {
+               acpi_object_type                    type;
+               u32                                 count;      /* # of elements in package */
+               union acpi_object                   *elements;  /* Pointer to an array of ACPI_OBJECTs */
+       } package;
+
+       struct
+       {
+               acpi_object_type                    type;
+               u32                                 proc_id;
+               acpi_io_address                     pblk_address;
+               u32                                 pblk_length;
+       } processor;
+
+       struct
+       {
+               acpi_object_type                    type;
+               u32                                 system_level;
+               u32                                 resource_order;
+       } power_resource;
+};
+
+
+/*
+ * List of objects, used as a parameter list for control method evaluation
+ */
+struct acpi_object_list
+{
+       u32                                 count;
+       union acpi_object                   *pointer;
+};
+
+
+/*
+ * Miscellaneous common Data Structures used by the interfaces
+ */
+#define ACPI_NO_BUFFER              0
+#define ACPI_ALLOCATE_BUFFER        (acpi_size) (-1)
+#define ACPI_ALLOCATE_LOCAL_BUFFER  (acpi_size) (-2)
+
+struct acpi_buffer
+{
+       acpi_size                           length;         /* Length in bytes of the buffer */
+       void                                *pointer;       /* pointer to buffer */
+};
+
+
+/*
+ * name_type for acpi_get_name
+ */
+#define ACPI_FULL_PATHNAME              0
+#define ACPI_SINGLE_NAME                1
+#define ACPI_NAME_TYPE_MAX              1
+
+
+/*
+ * Structure and flags for acpi_get_system_info
+ */
+#define ACPI_SYS_MODE_UNKNOWN           0x0000
+#define ACPI_SYS_MODE_ACPI              0x0001
+#define ACPI_SYS_MODE_LEGACY            0x0002
+#define ACPI_SYS_MODES_MASK             0x0003
+
+
+/*
+ * ACPI Table Info.  One per ACPI table _type_
+ */
+struct acpi_table_info
+{
+       u32                                 count;
+};
+
+
+/*
+ * System info returned by acpi_get_system_info()
+ */
+struct acpi_system_info
+{
+       u32                                 acpi_ca_version;
+       u32                                 flags;
+       u32                                 timer_resolution;
+       u32                                 reserved1;
+       u32                                 reserved2;
+       u32                                 debug_level;
+       u32                                 debug_layer;
+       u32                                 num_table_types;
+       struct acpi_table_info              table_info [NUM_ACPI_TABLE_TYPES];
+};
+
+
+/*
+ * Types specific to the OS service interfaces
+ */
+
+typedef u32
+(ACPI_SYSTEM_XFACE *OSD_HANDLER) (
+       void                            *context);
+
+typedef void
+(ACPI_SYSTEM_XFACE *OSD_EXECUTION_CALLBACK) (
+       void                            *context);
+
+/*
+ * Various handlers and callback procedures
+ */
+typedef
+u32 (*acpi_event_handler) (
+       void                                *context);
+
+typedef
+void (*acpi_gpe_handler) (
+       void                                *context);
+
+typedef
+void (*acpi_notify_handler) (
+       acpi_handle                         device,
+       u32                                 value,
+       void                                *context);
+
+typedef
+void (*acpi_object_handler) (
+       acpi_handle                         object,
+       u32                                 function,
+       void                                *data);
+
+typedef
+acpi_status (*acpi_init_handler) (
+       acpi_handle                         object,
+       u32                                 function);
+
+#define ACPI_INIT_DEVICE_INI        1
+
+
+/* Address Spaces (Operation Regions */
+
+typedef
+acpi_status (*acpi_adr_space_handler) (
+       u32                                 function,
+       acpi_physical_address               address,
+       u32                                 bit_width,
+       acpi_integer                        *value,
+       void                                *handler_context,
+       void                                *region_context);
+
+#define ACPI_DEFAULT_HANDLER        NULL
+
+
+typedef
+acpi_status (*acpi_adr_space_setup) (
+       acpi_handle                         region_handle,
+       u32                                 function,
+       void                                *handler_context,
+       void                                **region_context);
+
+#define ACPI_REGION_ACTIVATE    0
+#define ACPI_REGION_DEACTIVATE  1
+
+typedef
+acpi_status (*acpi_walk_callback) (
+       acpi_handle                         obj_handle,
+       u32                                 nesting_level,
+       void                                *context,
+       void                                **return_value);
+
+
+/* Interrupt handler return values */
+
+#define ACPI_INTERRUPT_NOT_HANDLED      0x00
+#define ACPI_INTERRUPT_HANDLED          0x01
+
+
+/* Common string version of device HIDs and UIDs */
+
+struct acpi_device_id
+{
+       char                            value[ACPI_DEVICE_ID_LENGTH];
+};
+
+/* Common string version of device CIDs */
+
+struct acpi_compatible_id
+{
+       char                            value[ACPI_MAX_CID_LENGTH];
+};
+
+struct acpi_compatible_id_list
+{
+       u32                             count;
+       u32                             size;
+       struct acpi_compatible_id       id[1];
+};
+
+
+/* Structure and flags for acpi_get_object_info */
+
+#define ACPI_VALID_STA                  0x0001
+#define ACPI_VALID_ADR                  0x0002
+#define ACPI_VALID_HID                  0x0004
+#define ACPI_VALID_UID                  0x0008
+#define ACPI_VALID_CID                  0x0010
+
+
+#define ACPI_COMMON_OBJ_INFO \
+       acpi_object_type                    type;           /* ACPI object type */ \
+       acpi_name                           name            /* ACPI object Name */
+
+
+struct acpi_obj_info_header
+{
+       ACPI_COMMON_OBJ_INFO;
+};
+
+
+/* Structure returned from Get Object Info */
+
+struct acpi_device_info
+{
+       ACPI_COMMON_OBJ_INFO;
+
+       u32                                 valid;              /* Indicates which fields are valid */
+       u32                                 current_status;     /* _STA value */
+       acpi_integer                        address;            /* _ADR value if any */
+       struct acpi_device_id               hardware_id;        /* _HID value if any */
+       struct acpi_device_id               unique_id;          /* _UID value if any */
+       struct acpi_compatible_id_list      compatibility_id;   /* List of _CIDs if any */
+};
+
+
+/* Context structs for address space handlers */
+
+struct acpi_pci_id
+{
+       u16                                 segment;
+       u16                                 bus;
+       u16                                 device;
+       u16                                 function;
+};
+
+
+struct acpi_mem_space_context
+{
+       u32                                 length;
+       acpi_physical_address               address;
+       acpi_physical_address               mapped_physical_address;
+       u8                                  *mapped_logical_address;
+       acpi_size                           mapped_length;
+};
+
+
+/*
+ * Definitions for Resource Attributes
+ */
+
+/*
+ *  Memory Attributes
+ */
+#define ACPI_READ_ONLY_MEMORY           (u8) 0x00
+#define ACPI_READ_WRITE_MEMORY          (u8) 0x01
+
+#define ACPI_NON_CACHEABLE_MEMORY       (u8) 0x00
+#define ACPI_CACHABLE_MEMORY            (u8) 0x01
+#define ACPI_WRITE_COMBINING_MEMORY     (u8) 0x02
+#define ACPI_PREFETCHABLE_MEMORY        (u8) 0x03
+
+/*
+ *  IO Attributes
+ *  The ISA Io ranges are:     n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh.
+ *  The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh.
+ */
+#define ACPI_NON_ISA_ONLY_RANGES        (u8) 0x01
+#define ACPI_ISA_ONLY_RANGES            (u8) 0x02
+#define ACPI_ENTIRE_RANGE               (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
+
+#define ACPI_SPARSE_TRANSLATION         (u8) 0x03
+
+/*
+ *  IO Port Descriptor Decode
+ */
+#define ACPI_DECODE_10                  (u8) 0x00    /* 10-bit IO address decode */
+#define ACPI_DECODE_16                  (u8) 0x01    /* 16-bit IO address decode */
+
+/*
+ *  IRQ Attributes
+ */
+#define ACPI_EDGE_SENSITIVE             (u8) 0x00
+#define ACPI_LEVEL_SENSITIVE            (u8) 0x01
+
+#define ACPI_ACTIVE_HIGH                (u8) 0x00
+#define ACPI_ACTIVE_LOW                 (u8) 0x01
+
+#define ACPI_EXCLUSIVE                  (u8) 0x00
+#define ACPI_SHARED                     (u8) 0x01
+
+/*
+ *  DMA Attributes
+ */
+#define ACPI_COMPATIBILITY              (u8) 0x00
+#define ACPI_TYPE_A                     (u8) 0x01
+#define ACPI_TYPE_B                     (u8) 0x02
+#define ACPI_TYPE_F                     (u8) 0x03
+
+#define ACPI_NOT_BUS_MASTER             (u8) 0x00
+#define ACPI_BUS_MASTER                 (u8) 0x01
+
+#define ACPI_TRANSFER_8                 (u8) 0x00
+#define ACPI_TRANSFER_8_16              (u8) 0x01
+#define ACPI_TRANSFER_16                (u8) 0x02
+
+/*
+ * Start Dependent Functions Priority definitions
+ */
+#define ACPI_GOOD_CONFIGURATION         (u8) 0x00
+#define ACPI_ACCEPTABLE_CONFIGURATION   (u8) 0x01
+#define ACPI_SUB_OPTIMAL_CONFIGURATION  (u8) 0x02
+
+/*
+ *  16, 32 and 64-bit Address Descriptor resource types
+ */
+#define ACPI_MEMORY_RANGE               (u8) 0x00
+#define ACPI_IO_RANGE                   (u8) 0x01
+#define ACPI_BUS_NUMBER_RANGE           (u8) 0x02
+
+#define ACPI_ADDRESS_NOT_FIXED          (u8) 0x00
+#define ACPI_ADDRESS_FIXED              (u8) 0x01
+
+#define ACPI_POS_DECODE                 (u8) 0x00
+#define ACPI_SUB_DECODE                 (u8) 0x01
+
+#define ACPI_PRODUCER                   (u8) 0x00
+#define ACPI_CONSUMER                   (u8) 0x01
+
+
+/*
+ *  Structures used to describe device resources
+ */
+struct acpi_resource_irq
+{
+       u32                                 edge_level;
+       u32                                 active_high_low;
+       u32                                 shared_exclusive;
+       u32                                 number_of_interrupts;
+       u32                                 interrupts[1];
+};
+
+struct acpi_resource_dma
+{
+       u32                                 type;
+       u32                                 bus_master;
+       u32                                 transfer;
+       u32                                 number_of_channels;
+       u32                                 channels[1];
+};
+
+struct acpi_resource_start_dpf
+{
+       u32                                 compatibility_priority;
+       u32                                 performance_robustness;
+};
+
+/*
+ * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
+ * needed because it has no fields
+ */
+
+struct acpi_resource_io
+{
+       u32                                 io_decode;
+       u32                                 min_base_address;
+       u32                                 max_base_address;
+       u32                                 alignment;
+       u32                                 range_length;
+};
+
+struct acpi_resource_fixed_io
+{
+       u32                                 base_address;
+       u32                                 range_length;
+};
+
+struct acpi_resource_vendor
+{
+       u32                                 length;
+       u8                                  reserved[1];
+};
+
+struct acpi_resource_end_tag
+{
+       u8                                  checksum;
+};
+
+struct acpi_resource_mem24
+{
+       u32                                 read_write_attribute;
+       u32                                 min_base_address;
+       u32                                 max_base_address;
+       u32                                 alignment;
+       u32                                 range_length;
+};
+
+struct acpi_resource_mem32
+{
+       u32                                 read_write_attribute;
+       u32                                 min_base_address;
+       u32                                 max_base_address;
+       u32                                 alignment;
+       u32                                 range_length;
+};
+
+struct acpi_resource_fixed_mem32
+{
+       u32                                 read_write_attribute;
+       u32                                 range_base_address;
+       u32                                 range_length;
+};
+
+struct acpi_memory_attribute
+{
+       u16                                 cache_attribute;
+       u16                                 read_write_attribute;
+};
+
+struct acpi_io_attribute
+{
+       u16                                 range_attribute;
+       u16                                 translation_attribute;
+};
+
+struct acpi_bus_attribute
+{
+       u16                                 reserved1;
+       u16                                 reserved2;
+};
+
+union acpi_resource_attribute
+{
+       struct acpi_memory_attribute        memory;
+       struct acpi_io_attribute            io;
+       struct acpi_bus_attribute           bus;
+};
+
+struct acpi_resource_source
+{
+       u32                                 index;
+       u32                                 string_length;
+       char                                *string_ptr;
+};
+
+struct acpi_resource_address16
+{
+       u32                                 resource_type;
+       u32                                 producer_consumer;
+       u32                                 decode;
+       u32                                 min_address_fixed;
+       u32                                 max_address_fixed;
+       union acpi_resource_attribute       attribute;
+       u32                                 granularity;
+       u32                                 min_address_range;
+       u32                                 max_address_range;
+       u32                                 address_translation_offset;
+       u32                                 address_length;
+       struct acpi_resource_source         resource_source;
+};
+
+struct acpi_resource_address32
+{
+       u32                                 resource_type;
+       u32                                 producer_consumer;
+       u32                                 decode;
+       u32                                 min_address_fixed;
+       u32                                 max_address_fixed;
+       union acpi_resource_attribute       attribute;
+       u32                                 granularity;
+       u32                                 min_address_range;
+       u32                                 max_address_range;
+       u32                                 address_translation_offset;
+       u32                                 address_length;
+       struct acpi_resource_source         resource_source;
+};
+
+struct acpi_resource_address64
+{
+       u32                                 resource_type;
+       u32                                 producer_consumer;
+       u32                                 decode;
+       u32                                 min_address_fixed;
+       u32                                 max_address_fixed;
+       union acpi_resource_attribute       attribute;
+       u64                                 granularity;
+       u64                                 min_address_range;
+       u64                                 max_address_range;
+       u64                                 address_translation_offset;
+       u64                                 address_length;
+       struct acpi_resource_source         resource_source;
+};
+
+struct acpi_resource_ext_irq
+{
+       u32                                 producer_consumer;
+       u32                                 edge_level;
+       u32                                 active_high_low;
+       u32                                 shared_exclusive;
+       u32                                 number_of_interrupts;
+       struct acpi_resource_source         resource_source;
+       u32                                 interrupts[1];
+};
+
+
+/* ACPI_RESOURCE_TYPEs */
+
+#define ACPI_RSTYPE_IRQ                 0
+#define ACPI_RSTYPE_DMA                 1
+#define ACPI_RSTYPE_START_DPF           2
+#define ACPI_RSTYPE_END_DPF             3
+#define ACPI_RSTYPE_IO                  4
+#define ACPI_RSTYPE_FIXED_IO            5
+#define ACPI_RSTYPE_VENDOR              6
+#define ACPI_RSTYPE_END_TAG             7
+#define ACPI_RSTYPE_MEM24               8
+#define ACPI_RSTYPE_MEM32               9
+#define ACPI_RSTYPE_FIXED_MEM32         10
+#define ACPI_RSTYPE_ADDRESS16           11
+#define ACPI_RSTYPE_ADDRESS32           12
+#define ACPI_RSTYPE_ADDRESS64           13
+#define ACPI_RSTYPE_EXT_IRQ             14
+
+typedef u32                                     acpi_resource_type;
+
+union acpi_resource_data
+{
+       struct acpi_resource_irq            irq;
+       struct acpi_resource_dma            dma;
+       struct acpi_resource_start_dpf      start_dpf;
+       struct acpi_resource_io             io;
+       struct acpi_resource_fixed_io       fixed_io;
+       struct acpi_resource_vendor         vendor_specific;
+       struct acpi_resource_end_tag        end_tag;
+       struct acpi_resource_mem24          memory24;
+       struct acpi_resource_mem32          memory32;
+       struct acpi_resource_fixed_mem32    fixed_memory32;
+       struct acpi_resource_address16      address16;
+       struct acpi_resource_address32      address32;
+       struct acpi_resource_address64      address64;
+       struct acpi_resource_ext_irq        extended_irq;
+};
+
+struct acpi_resource
+{
+       acpi_resource_type                  id;
+       u32                                 length;
+       union acpi_resource_data            data;
+};
+
+#define ACPI_RESOURCE_LENGTH                12
+#define ACPI_RESOURCE_LENGTH_NO_DATA        8       /* Id + Length fields */
+
+#define ACPI_SIZEOF_RESOURCE(type)          (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
+
+#define ACPI_NEXT_RESOURCE(res)             (struct acpi_resource *)((u8 *) res + res->length)
+
+#ifdef ACPI_MISALIGNED_TRANSFERS
+#define ACPI_ALIGN_RESOURCE_SIZE(length)    (length)
+#else
+#define ACPI_ALIGN_RESOURCE_SIZE(length)    ACPI_ROUND_UP_TO_NATIVE_WORD(length)
+#endif
+
+/*
+ * END: of definitions for Resource Attributes
+ */
+
+
+struct acpi_pci_routing_table
+{
+       u32                                 length;
+       u32                                 pin;
+       acpi_integer                        address;        /* here for 64-bit alignment */
+       u32                                 source_index;
+       char                                source[4];      /* pad to 64 bits so sizeof() works in all cases */
+};
+
+/*
+ * END: of definitions for PCI Routing tables
+ */
+
+
+#endif /* __ACTYPES_H__ */
diff --git a/xen/include/acpi/acutils.h b/xen/include/acpi/acutils.h
new file mode 100644 (file)
index 0000000..4927d6b
--- /dev/null
@@ -0,0 +1,844 @@
+/******************************************************************************
+ *
+ * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef _ACUTILS_H
+#define _ACUTILS_H
+
+
+typedef
+acpi_status (*acpi_pkg_callback) (
+       u8                              object_type,
+       union acpi_operand_object       *source_object,
+       union acpi_generic_state        *state,
+       void                            *context);
+
+
+acpi_status
+acpi_ut_walk_package_tree (
+       union acpi_operand_object       *source_object,
+       void                            *target_object,
+       acpi_pkg_callback               walk_callback,
+       void                            *context);
+
+
+struct acpi_pkg_info
+{
+       u8                              *free_space;
+       acpi_size                       length;
+       u32                             object_space;
+       u32                             num_packages;
+};
+
+#define REF_INCREMENT       (u16) 0
+#define REF_DECREMENT       (u16) 1
+#define REF_FORCE_DELETE    (u16) 2
+
+/* acpi_ut_dump_buffer */
+
+#define DB_BYTE_DISPLAY     1
+#define DB_WORD_DISPLAY     2
+#define DB_DWORD_DISPLAY    4
+#define DB_QWORD_DISPLAY    8
+
+
+/* Global initialization interfaces */
+
+void
+acpi_ut_init_globals (
+       void);
+
+void
+acpi_ut_terminate (
+       void);
+
+
+/*
+ * ut_init - miscellaneous initialization and shutdown
+ */
+
+acpi_status
+acpi_ut_hardware_initialize (
+       void);
+
+void
+acpi_ut_subsystem_shutdown (
+       void);
+
+acpi_status
+acpi_ut_validate_fadt (
+       void);
+
+/*
+ * ut_global - Global data structures and procedures
+ */
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
+char *
+acpi_ut_get_mutex_name (
+       u32                             mutex_id);
+
+#endif
+
+char *
+acpi_ut_get_type_name (
+       acpi_object_type                type);
+
+char *
+acpi_ut_get_node_name (
+       void                            *object);
+
+char *
+acpi_ut_get_descriptor_name (
+       void                            *object);
+
+char *
+acpi_ut_get_object_type_name (
+       union acpi_operand_object       *obj_desc);
+
+char *
+acpi_ut_get_region_name (
+       u8                              space_id);
+
+char *
+acpi_ut_get_event_name (
+       u32                             event_id);
+
+char
+acpi_ut_hex_to_ascii_char (
+       acpi_integer                    integer,
+       u32                             position);
+
+u8
+acpi_ut_valid_object_type (
+       acpi_object_type                type);
+
+acpi_owner_id
+acpi_ut_allocate_owner_id (
+       u32                             id_type);
+
+
+/*
+ * ut_clib - Local implementations of C library functions
+ */
+
+#ifndef ACPI_USE_SYSTEM_CLIBRARY
+
+acpi_size
+acpi_ut_strlen (
+       const char                      *string);
+
+char *
+acpi_ut_strcpy (
+       char                            *dst_string,
+       const char                      *src_string);
+
+char *
+acpi_ut_strncpy (
+       char                            *dst_string,
+       const char                      *src_string,
+       acpi_size                       count);
+
+int
+acpi_ut_strncmp (
+       const char                      *string1,
+       const char                      *string2,
+       acpi_size                       count);
+
+int
+acpi_ut_strcmp (
+       const char                      *string1,
+       const char                      *string2);
+
+char *
+acpi_ut_strcat (
+       char                            *dst_string,
+       const char                      *src_string);
+
+char *
+acpi_ut_strncat (
+       char                            *dst_string,
+       const char                      *src_string,
+       acpi_size                       count);
+
+u32
+acpi_ut_strtoul (
+       const char                      *string,
+       char                            **terminator,
+       u32                             base);
+
+char *
+acpi_ut_strstr (
+       char                            *string1,
+       char                            *string2);
+
+void *
+acpi_ut_memcpy (
+       void                            *dest,
+       const void                      *src,
+       acpi_size                       count);
+
+void *
+acpi_ut_memset (
+       void                            *dest,
+       acpi_native_uint                value,
+       acpi_size                       count);
+
+int
+acpi_ut_to_upper (
+       int                             c);
+
+int
+acpi_ut_to_lower (
+       int                             c);
+
+extern const u8 _acpi_ctype[];
+
+#define _ACPI_XA     0x00    /* extra alphabetic - not supported */
+#define _ACPI_XS     0x40    /* extra space */
+#define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
+#define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
+#define _ACPI_DI     0x04    /* '0'-'9' */
+#define _ACPI_LO     0x02    /* 'a'-'z' */
+#define _ACPI_PU     0x10    /* punctuation */
+#define _ACPI_SP     0x08    /* space */
+#define _ACPI_UP     0x01    /* 'A'-'Z' */
+#define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
+
+#define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
+#define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
+#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
+#define ACPI_IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
+#define ACPI_IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
+#define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
+#define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
+#define ACPI_IS_ASCII(c)  ((c) < 0x80)
+
+#endif /* ACPI_USE_SYSTEM_CLIBRARY */
+
+/*
+ * ut_copy - Object construction and conversion interfaces
+ */
+
+acpi_status
+acpi_ut_build_simple_object(
+       union acpi_operand_object       *obj,
+       union acpi_object               *user_obj,
+       u8                              *data_space,
+       u32                             *buffer_space_used);
+
+acpi_status
+acpi_ut_build_package_object (
+       union acpi_operand_object       *obj,
+       u8                              *buffer,
+       u32                             *space_used);
+
+acpi_status
+acpi_ut_copy_ielement_to_eelement (
+       u8                              object_type,
+       union acpi_operand_object       *source_object,
+       union acpi_generic_state        *state,
+       void                            *context);
+
+acpi_status
+acpi_ut_copy_ielement_to_ielement (
+       u8                              object_type,
+       union acpi_operand_object       *source_object,
+       union acpi_generic_state        *state,
+       void                            *context);
+
+acpi_status
+acpi_ut_copy_iobject_to_eobject (
+       union acpi_operand_object       *obj,
+       struct acpi_buffer              *ret_buffer);
+
+acpi_status
+acpi_ut_copy_esimple_to_isimple(
+       union acpi_object               *user_obj,
+       union acpi_operand_object       **return_obj);
+
+acpi_status
+acpi_ut_copy_eobject_to_iobject (
+       union acpi_object               *obj,
+       union acpi_operand_object       **internal_obj);
+
+acpi_status
+acpi_ut_copy_isimple_to_isimple (
+       union acpi_operand_object       *source_obj,
+       union acpi_operand_object       *dest_obj);
+
+acpi_status
+acpi_ut_copy_ipackage_to_ipackage (
+       union acpi_operand_object       *source_obj,
+       union acpi_operand_object       *dest_obj,
+       struct acpi_walk_state          *walk_state);
+
+acpi_status
+acpi_ut_copy_simple_object (
+       union acpi_operand_object       *source_desc,
+       union acpi_operand_object       *dest_desc);
+
+acpi_status
+acpi_ut_copy_iobject_to_iobject (
+       union acpi_operand_object       *source_desc,
+       union acpi_operand_object       **dest_desc,
+       struct acpi_walk_state          *walk_state);
+
+
+/*
+ * ut_create - Object creation
+ */
+
+acpi_status
+acpi_ut_update_object_reference (
+       union acpi_operand_object       *object,
+       u16                             action);
+
+
+/*
+ * ut_debug - Debug interfaces
+ */
+
+void
+acpi_ut_init_stack_ptr_trace (
+       void);
+
+void
+acpi_ut_track_stack_ptr (
+       void);
+
+void
+acpi_ut_trace (
+       u32                             line_number,
+       struct acpi_debug_print_info    *dbg_info);
+
+void
+acpi_ut_trace_ptr (
+       u32                             line_number,
+       struct acpi_debug_print_info    *dbg_info,
+       void                            *pointer);
+
+void
+acpi_ut_trace_u32 (
+       u32                             line_number,
+       struct acpi_debug_print_info    *dbg_info,
+       u32                             integer);
+
+void
+acpi_ut_trace_str (
+       u32                             line_number,
+       struct acpi_debug_print_info    *dbg_info,
+       char                            *string);
+
+void
+acpi_ut_exit (
+       u32                             line_number,
+       struct acpi_debug_print_info    *dbg_info);
+
+void
+acpi_ut_status_exit (
+       u32                             line_number,
+       struct acpi_debug_print_info    *dbg_info,
+       acpi_status                     status);
+
+void
+acpi_ut_value_exit (
+       u32                             line_number,
+       struct acpi_debug_print_info    *dbg_info,
+       acpi_integer                    value);
+
+void
+acpi_ut_ptr_exit (
+       u32                             line_number,
+       struct acpi_debug_print_info    *dbg_info,
+       u8                              *ptr);
+
+void
+acpi_ut_report_info (
+       char                            *module_name,
+       u32                             line_number,
+       u32                             component_id);
+
+void
+acpi_ut_report_error (
+       char                            *module_name,
+       u32                             line_number,
+       u32                             component_id);
+
+void
+acpi_ut_report_warning (
+       char                            *module_name,
+       u32                             line_number,
+       u32                             component_id);
+
+void
+acpi_ut_dump_buffer (
+       u8                              *buffer,
+       u32                             count,
+       u32                             display,
+       u32                             component_id);
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_debug_print (
+       u32                             requested_debug_level,
+       u32                             line_number,
+       struct acpi_debug_print_info    *dbg_info,
+       char                            *format,
+       ...) ACPI_PRINTF_LIKE_FUNC;
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_debug_print_raw (
+       u32                             requested_debug_level,
+       u32                             line_number,
+       struct acpi_debug_print_info    *dbg_info,
+       char                            *format,
+       ...) ACPI_PRINTF_LIKE_FUNC;
+
+
+/*
+ * ut_delete - Object deletion
+ */
+
+void
+acpi_ut_delete_internal_obj (
+       union acpi_operand_object       *object);
+
+void
+acpi_ut_delete_internal_package_object (
+       union acpi_operand_object       *object);
+
+void
+acpi_ut_delete_internal_simple_object (
+       union acpi_operand_object       *object);
+
+void
+acpi_ut_delete_internal_object_list (
+       union acpi_operand_object       **obj_list);
+
+
+/*
+ * ut_eval - object evaluation
+ */
+
+/* Method name strings */
+
+#define METHOD_NAME__HID        "_HID"
+#define METHOD_NAME__CID        "_CID"
+#define METHOD_NAME__UID        "_UID"
+#define METHOD_NAME__ADR        "_ADR"
+#define METHOD_NAME__STA        "_STA"
+#define METHOD_NAME__REG        "_REG"
+#define METHOD_NAME__SEG        "_SEG"
+#define METHOD_NAME__BBN        "_BBN"
+#define METHOD_NAME__PRT        "_PRT"
+#define METHOD_NAME__CRS        "_CRS"
+#define METHOD_NAME__PRS        "_PRS"
+
+
+acpi_status
+acpi_ut_evaluate_object (
+       struct acpi_namespace_node      *prefix_node,
+       char                            *path,
+       u32                             expected_return_btypes,
+       union acpi_operand_object       **return_desc);
+
+acpi_status
+acpi_ut_evaluate_numeric_object (
+       char                            *object_name,
+       struct acpi_namespace_node      *device_node,
+       acpi_integer                    *address);
+
+acpi_status
+acpi_ut_execute_HID (
+       struct acpi_namespace_node      *device_node,
+       struct acpi_device_id           *hid);
+
+acpi_status
+acpi_ut_execute_CID (
+       struct acpi_namespace_node      *device_node,
+       struct acpi_compatible_id_list **return_cid_list);
+
+acpi_status
+acpi_ut_execute_STA (
+       struct acpi_namespace_node      *device_node,
+       u32                             *status_flags);
+
+acpi_status
+acpi_ut_execute_UID (
+       struct acpi_namespace_node      *device_node,
+       struct acpi_device_id           *uid);
+
+
+/*
+ * ut_mutex - mutual exclusion interfaces
+ */
+
+acpi_status
+acpi_ut_mutex_initialize (
+       void);
+
+void
+acpi_ut_mutex_terminate (
+       void);
+
+acpi_status
+acpi_ut_create_mutex (
+       acpi_mutex_handle               mutex_id);
+
+acpi_status
+acpi_ut_delete_mutex (
+       acpi_mutex_handle               mutex_id);
+
+acpi_status
+acpi_ut_acquire_mutex (
+       acpi_mutex_handle               mutex_id);
+
+acpi_status
+acpi_ut_release_mutex (
+       acpi_mutex_handle               mutex_id);
+
+
+/*
+ * ut_object - internal object create/delete/cache routines
+ */
+
+union acpi_operand_object    *
+acpi_ut_create_internal_object_dbg (
+       char                            *module_name,
+       u32                             line_number,
+       u32                             component_id,
+       acpi_object_type                type);
+
+void *
+acpi_ut_allocate_object_desc_dbg (
+       char                            *module_name,
+       u32                             line_number,
+       u32                             component_id);
+
+#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
+#define acpi_ut_allocate_object_desc()  acpi_ut_allocate_object_desc_dbg (_THIS_MODULE,__LINE__,_COMPONENT)
+
+void
+acpi_ut_delete_object_desc (
+       union acpi_operand_object       *object);
+
+u8
+acpi_ut_valid_internal_object (
+       void                            *object);
+
+union acpi_operand_object *
+acpi_ut_create_buffer_object (
+       acpi_size                       buffer_size);
+
+
+/*
+ * ut_ref_cnt - Object reference count management
+ */
+
+void
+acpi_ut_add_reference (
+       union acpi_operand_object       *object);
+
+void
+acpi_ut_remove_reference (
+       union acpi_operand_object       *object);
+
+/*
+ * ut_size - Object size routines
+ */
+
+acpi_status
+acpi_ut_get_simple_object_size (
+       union acpi_operand_object       *obj,
+       acpi_size                       *obj_length);
+
+acpi_status
+acpi_ut_get_package_object_size (
+       union acpi_operand_object       *obj,
+       acpi_size                       *obj_length);
+
+acpi_status
+acpi_ut_get_object_size(
+       union acpi_operand_object       *obj,
+       acpi_size                       *obj_length);
+
+acpi_status
+acpi_ut_get_element_length (
+       u8                              object_type,
+       union acpi_operand_object       *source_object,
+       union acpi_generic_state        *state,
+       void                            *context);
+
+
+/*
+ * ut_state - Generic state creation/cache routines
+ */
+
+void
+acpi_ut_push_generic_state (
+       union acpi_generic_state        **list_head,
+       union acpi_generic_state        *state);
+
+union acpi_generic_state *
+acpi_ut_pop_generic_state (
+       union acpi_generic_state        **list_head);
+
+
+union acpi_generic_state *
+acpi_ut_create_generic_state (
+       void);
+
+struct acpi_thread_state *
+acpi_ut_create_thread_state (
+       void);
+
+union acpi_generic_state *
+acpi_ut_create_update_state (
+       union acpi_operand_object       *object,
+       u16                             action);
+
+union acpi_generic_state *
+acpi_ut_create_pkg_state (
+       void                            *internal_object,
+       void                            *external_object,
+       u16                             index);
+
+acpi_status
+acpi_ut_create_update_state_and_push (
+       union acpi_operand_object       *object,
+       u16                             action,
+       union acpi_generic_state        **state_list);
+
+acpi_status
+acpi_ut_create_pkg_state_and_push (
+       void                            *internal_object,
+       void                            *external_object,
+       u16                             index,
+       union acpi_generic_state        **state_list);
+
+union acpi_generic_state *
+acpi_ut_create_control_state (
+       void);
+
+void
+acpi_ut_delete_generic_state (
+       union acpi_generic_state        *state);
+
+void
+acpi_ut_delete_generic_state_cache (
+       void);
+
+void
+acpi_ut_delete_object_cache (
+       void);
+
+/*
+ * utmisc
+ */
+
+void
+acpi_ut_print_string (
+       char                            *string,
+       u8                              max_length);
+
+acpi_status
+acpi_ut_divide (
+       acpi_integer                    *in_dividend,
+       acpi_integer                    *in_divisor,
+       acpi_integer                    *out_quotient,
+       acpi_integer                    *out_remainder);
+
+acpi_status
+acpi_ut_short_divide (
+       acpi_integer                    *in_dividend,
+       u32                             divisor,
+       acpi_integer                    *out_quotient,
+       u32                             *out_remainder);
+
+u8
+acpi_ut_valid_acpi_name (
+       u32                             name);
+
+u8
+acpi_ut_valid_acpi_character (
+       char                            character);
+
+acpi_status
+acpi_ut_strtoul64 (
+       char                            *string,
+       u32                             base,
+       acpi_integer                    *ret_integer);
+
+char *
+acpi_ut_strupr (
+       char                            *src_string);
+
+u8 *
+acpi_ut_get_resource_end_tag (
+       union acpi_operand_object       *obj_desc);
+
+u8
+acpi_ut_generate_checksum (
+       u8                              *buffer,
+       u32                             length);
+
+u32
+acpi_ut_dword_byte_swap (
+       u32                             value);
+
+void
+acpi_ut_set_integer_width (
+       u8                              revision);
+
+#ifdef ACPI_DEBUG_OUTPUT
+void
+acpi_ut_display_init_pathname (
+       u8                              type,
+       struct acpi_namespace_node      *obj_handle,
+       char                            *path);
+
+#endif
+
+
+/*
+ * Utalloc - memory allocation and object caching
+ */
+
+void *
+acpi_ut_acquire_from_cache (
+       u32                             list_id);
+
+void
+acpi_ut_release_to_cache (
+       u32                             list_id,
+       void                            *object);
+
+void
+acpi_ut_delete_generic_cache (
+       u32                             list_id);
+
+acpi_status
+acpi_ut_validate_buffer (
+       struct acpi_buffer              *buffer);
+
+acpi_status
+acpi_ut_initialize_buffer (
+       struct acpi_buffer              *buffer,
+       acpi_size                       required_length);
+
+
+/* Memory allocation functions */
+
+void *
+acpi_ut_allocate (
+       acpi_size                       size,
+       u32                             component,
+       char                            *module,
+       u32                             line);
+
+void *
+acpi_ut_callocate (
+       acpi_size                       size,
+       u32                             component,
+       char                            *module,
+       u32                             line);
+
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+void *
+acpi_ut_allocate_and_track (
+       acpi_size                       size,
+       u32                             component,
+       char                            *module,
+       u32                             line);
+
+void *
+acpi_ut_callocate_and_track (
+       acpi_size                       size,
+       u32                             component,
+       char                            *module,
+       u32                             line);
+
+void
+acpi_ut_free_and_track (
+       void                            *address,
+       u32                             component,
+       char                            *module,
+       u32                             line);
+
+struct acpi_debug_mem_block *
+acpi_ut_find_allocation (
+       u32                             list_id,
+       void                            *allocation);
+
+acpi_status
+acpi_ut_track_allocation (
+       u32                             list_id,
+       struct acpi_debug_mem_block     *address,
+       acpi_size                       size,
+       u8                              alloc_type,
+       u32                             component,
+       char                            *module,
+       u32                             line);
+
+acpi_status
+acpi_ut_remove_allocation (
+       u32                             list_id,
+       struct acpi_debug_mem_block     *address,
+       u32                             component,
+       char                            *module,
+       u32                             line);
+
+void
+acpi_ut_dump_allocation_info (
+       void);
+
+void
+acpi_ut_dump_allocations (
+       u32                             component,
+       char                            *module);
+#endif
+
+
+#endif /* _ACUTILS_H */
diff --git a/xen/include/acpi/amlcode.h b/xen/include/acpi/amlcode.h
new file mode 100644 (file)
index 0000000..512071a
--- /dev/null
@@ -0,0 +1,506 @@
+/******************************************************************************
+ *
+ * Name: amlcode.h - Definitions for AML, as included in "definition blocks"
+ *                   Declarations and definitions contained herein are derived
+ *                   directly from the ACPI specification.
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __AMLCODE_H__
+#define __AMLCODE_H__
+
+/* primary opcodes */
+
+#define AML_NULL_CHAR               (u16) 0x00
+
+#define AML_ZERO_OP                 (u16) 0x00
+#define AML_ONE_OP                  (u16) 0x01
+#define AML_UNASSIGNED              (u16) 0x02
+#define AML_ALIAS_OP                (u16) 0x06
+#define AML_NAME_OP                 (u16) 0x08
+#define AML_BYTE_OP                 (u16) 0x0a
+#define AML_WORD_OP                 (u16) 0x0b
+#define AML_DWORD_OP                (u16) 0x0c
+#define AML_STRING_OP               (u16) 0x0d
+#define AML_QWORD_OP                (u16) 0x0e     /* ACPI 2.0 */
+#define AML_SCOPE_OP                (u16) 0x10
+#define AML_BUFFER_OP               (u16) 0x11
+#define AML_PACKAGE_OP              (u16) 0x12
+#define AML_VAR_PACKAGE_OP          (u16) 0x13     /* ACPI 2.0 */
+#define AML_METHOD_OP               (u16) 0x14
+#define AML_DUAL_NAME_PREFIX        (u16) 0x2e
+#define AML_MULTI_NAME_PREFIX_OP    (u16) 0x2f
+#define AML_NAME_CHAR_SUBSEQ        (u16) 0x30
+#define AML_NAME_CHAR_FIRST         (u16) 0x41
+#define AML_OP_PREFIX               (u16) 0x5b
+#define AML_ROOT_PREFIX             (u16) 0x5c
+#define AML_PARENT_PREFIX           (u16) 0x5e
+#define AML_LOCAL_OP                (u16) 0x60
+#define AML_LOCAL0                  (u16) 0x60
+#define AML_LOCAL1                  (u16) 0x61
+#define AML_LOCAL2                  (u16) 0x62
+#define AML_LOCAL3                  (u16) 0x63
+#define AML_LOCAL4                  (u16) 0x64
+#define AML_LOCAL5                  (u16) 0x65
+#define AML_LOCAL6                  (u16) 0x66
+#define AML_LOCAL7                  (u16) 0x67
+#define AML_ARG_OP                  (u16) 0x68
+#define AML_ARG0                    (u16) 0x68
+#define AML_ARG1                    (u16) 0x69
+#define AML_ARG2                    (u16) 0x6a
+#define AML_ARG3                    (u16) 0x6b
+#define AML_ARG4                    (u16) 0x6c
+#define AML_ARG5                    (u16) 0x6d
+#define AML_ARG6                    (u16) 0x6e
+#define AML_STORE_OP                (u16) 0x70
+#define AML_REF_OF_OP               (u16) 0x71
+#define AML_ADD_OP                  (u16) 0x72
+#define AML_CONCAT_OP               (u16) 0x73
+#define AML_SUBTRACT_OP             (u16) 0x74
+#define AML_INCREMENT_OP            (u16) 0x75
+#define AML_DECREMENT_OP            (u16) 0x76
+#define AML_MULTIPLY_OP             (u16) 0x77
+#define AML_DIVIDE_OP               (u16) 0x78
+#define AML_SHIFT_LEFT_OP           (u16) 0x79
+#define AML_SHIFT_RIGHT_OP          (u16) 0x7a
+#define AML_BIT_AND_OP              (u16) 0x7b
+#define AML_BIT_NAND_OP             (u16) 0x7c
+#define AML_BIT_OR_OP               (u16) 0x7d
+#define AML_BIT_NOR_OP              (u16) 0x7e
+#define AML_BIT_XOR_OP              (u16) 0x7f
+#define AML_BIT_NOT_OP              (u16) 0x80
+#define AML_FIND_SET_LEFT_BIT_OP    (u16) 0x81
+#define AML_FIND_SET_RIGHT_BIT_OP   (u16) 0x82
+#define AML_DEREF_OF_OP             (u16) 0x83
+#define AML_CONCAT_RES_OP           (u16) 0x84     /* ACPI 2.0 */
+#define AML_MOD_OP                  (u16) 0x85     /* ACPI 2.0 */
+#define AML_NOTIFY_OP               (u16) 0x86
+#define AML_SIZE_OF_OP              (u16) 0x87
+#define AML_INDEX_OP                (u16) 0x88
+#define AML_MATCH_OP                (u16) 0x89
+#define AML_CREATE_DWORD_FIELD_OP   (u16) 0x8a
+#define AML_CREATE_WORD_FIELD_OP    (u16) 0x8b
+#define AML_CREATE_BYTE_FIELD_OP    (u16) 0x8c
+#define AML_CREATE_BIT_FIELD_OP     (u16) 0x8d
+#define AML_TYPE_OP                 (u16) 0x8e
+#define AML_CREATE_QWORD_FIELD_OP   (u16) 0x8f     /* ACPI 2.0 */
+#define AML_LAND_OP                 (u16) 0x90
+#define AML_LOR_OP                  (u16) 0x91
+#define AML_LNOT_OP                 (u16) 0x92
+#define AML_LEQUAL_OP               (u16) 0x93
+#define AML_LGREATER_OP             (u16) 0x94
+#define AML_LLESS_OP                (u16) 0x95
+#define AML_TO_BUFFER_OP            (u16) 0x96     /* ACPI 2.0 */
+#define AML_TO_DECSTRING_OP         (u16) 0x97     /* ACPI 2.0 */
+#define AML_TO_HEXSTRING_OP         (u16) 0x98     /* ACPI 2.0 */
+#define AML_TO_INTEGER_OP           (u16) 0x99     /* ACPI 2.0 */
+#define AML_TO_STRING_OP            (u16) 0x9c     /* ACPI 2.0 */
+#define AML_COPY_OP                 (u16) 0x9d     /* ACPI 2.0 */
+#define AML_MID_OP                  (u16) 0x9e     /* ACPI 2.0 */
+#define AML_CONTINUE_OP             (u16) 0x9f     /* ACPI 2.0 */
+#define AML_IF_OP                   (u16) 0xa0
+#define AML_ELSE_OP                 (u16) 0xa1
+#define AML_WHILE_OP                (u16) 0xa2
+#define AML_NOOP_OP                 (u16) 0xa3
+#define AML_RETURN_OP               (u16) 0xa4
+#define AML_BREAK_OP                (u16) 0xa5
+#define AML_BREAK_POINT_OP          (u16) 0xcc
+#define AML_ONES_OP                 (u16) 0xff
+
+/* prefixed opcodes */
+
+#define AML_EXTOP                   (u16) 0x005b
+
+
+#define AML_MUTEX_OP                (u16) 0x5b01
+#define AML_EVENT_OP                (u16) 0x5b02
+#define AML_SHIFT_RIGHT_BIT_OP      (u16) 0x5b10
+#define AML_SHIFT_LEFT_BIT_OP       (u16) 0x5b11
+#define AML_COND_REF_OF_OP          (u16) 0x5b12
+#define AML_CREATE_FIELD_OP         (u16) 0x5b13
+#define AML_LOAD_TABLE_OP           (u16) 0x5b1f     /* ACPI 2.0 */
+#define AML_LOAD_OP                 (u16) 0x5b20
+#define AML_STALL_OP                (u16) 0x5b21
+#define AML_SLEEP_OP                (u16) 0x5b22
+#define AML_ACQUIRE_OP              (u16) 0x5b23
+#define AML_SIGNAL_OP               (u16) 0x5b24
+#define AML_WAIT_OP                 (u16) 0x5b25
+#define AML_RESET_OP                (u16) 0x5b26
+#define AML_RELEASE_OP              (u16) 0x5b27
+#define AML_FROM_BCD_OP             (u16) 0x5b28
+#define AML_TO_BCD_OP               (u16) 0x5b29
+#define AML_UNLOAD_OP               (u16) 0x5b2a
+#define AML_REVISION_OP             (u16) 0x5b30
+#define AML_DEBUG_OP                (u16) 0x5b31
+#define AML_FATAL_OP                (u16) 0x5b32
+#define AML_REGION_OP               (u16) 0x5b80
+#define AML_FIELD_OP                (u16) 0x5b81
+#define AML_DEVICE_OP               (u16) 0x5b82
+#define AML_PROCESSOR_OP            (u16) 0x5b83
+#define AML_POWER_RES_OP            (u16) 0x5b84
+#define AML_THERMAL_ZONE_OP         (u16) 0x5b85
+#define AML_INDEX_FIELD_OP          (u16) 0x5b86
+#define AML_BANK_FIELD_OP           (u16) 0x5b87
+#define AML_DATA_REGION_OP          (u16) 0x5b88     /* ACPI 2.0 */
+
+
+/* Bogus opcodes (they are actually two separate opcodes) */
+
+#define AML_LGREATEREQUAL_OP        (u16) 0x9295
+#define AML_LLESSEQUAL_OP           (u16) 0x9294
+#define AML_LNOTEQUAL_OP            (u16) 0x9293
+
+
+/*
+ * Internal opcodes
+ * Use only "Unknown" AML opcodes, don't attempt to use
+ * any valid ACPI ASCII values (A-Z, 0-9, '-')
+ */
+
+#define AML_INT_NAMEPATH_OP         (u16) 0x002d
+#define AML_INT_NAMEDFIELD_OP       (u16) 0x0030
+#define AML_INT_RESERVEDFIELD_OP    (u16) 0x0031
+#define AML_INT_ACCESSFIELD_OP      (u16) 0x0032
+#define AML_INT_BYTELIST_OP         (u16) 0x0033
+#define AML_INT_STATICSTRING_OP     (u16) 0x0034
+#define AML_INT_METHODCALL_OP       (u16) 0x0035
+#define AML_INT_RETURN_VALUE_OP     (u16) 0x0036
+#define AML_INT_EVAL_SUBTREE_OP     (u16) 0x0037
+
+
+#define ARG_NONE                    0x0
+
+/*
+ * Argument types for the AML Parser
+ * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
+ * There can be up to 31 unique argument types
+ * Zero is reserved as end-of-list indicator
+ */
+
+#define ARGP_BYTEDATA               0x01
+#define ARGP_BYTELIST               0x02
+#define ARGP_CHARLIST               0x03
+#define ARGP_DATAOBJ                0x04
+#define ARGP_DATAOBJLIST            0x05
+#define ARGP_DWORDDATA              0x06
+#define ARGP_FIELDLIST              0x07
+#define ARGP_NAME                   0x08
+#define ARGP_NAMESTRING             0x09
+#define ARGP_OBJLIST                0x0A
+#define ARGP_PKGLENGTH              0x0B
+#define ARGP_SUPERNAME              0x0C
+#define ARGP_TARGET                 0x0D
+#define ARGP_TERMARG                0x0E
+#define ARGP_TERMLIST               0x0F
+#define ARGP_WORDDATA               0x10
+#define ARGP_QWORDDATA              0x11
+#define ARGP_SIMPLENAME             0x12
+
+/*
+ * Resolved argument types for the AML Interpreter
+ * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
+ * There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
+ *
+ * Note1: These values are completely independent from the ACPI_TYPEs
+ *        i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER
+ *
+ * Note2: If and when 5 bits becomes insufficient, it would probably be best
+ * to convert to a 6-byte array of argument types, allowing 8 bits per argument.
+ */
+
+/* Single, simple types */
+
+#define ARGI_ANYTYPE                0x01    /* Don't care */
+#define ARGI_PACKAGE                0x02
+#define ARGI_EVENT                  0x03
+#define ARGI_MUTEX                  0x04
+#define ARGI_DDBHANDLE              0x05
+
+/* Interchangeable types (via implicit conversion) */
+
+#define ARGI_INTEGER                0x06
+#define ARGI_STRING                 0x07
+#define ARGI_BUFFER                 0x08
+#define ARGI_BUFFER_OR_STRING       0x09    /* Used by MID op only */
+#define ARGI_COMPUTEDATA            0x0A    /* Buffer, String, or Integer */
+
+/* Reference objects */
+
+#define ARGI_INTEGER_REF            0x0B
+#define ARGI_OBJECT_REF             0x0C
+#define ARGI_DEVICE_REF             0x0D
+#define ARGI_REFERENCE              0x0E
+#define ARGI_TARGETREF              0x0F    /* Target, subject to implicit conversion */
+#define ARGI_FIXED_TARGET           0x10    /* Target, no implicit conversion */
+#define ARGI_SIMPLE_TARGET          0x11    /* Name, Local, Arg -- no implicit conversion */
+
+/* Multiple/complex types */
+
+#define ARGI_DATAOBJECT             0x12    /* Buffer, String, package or reference to a Node - Used only by size_of operator*/
+#define ARGI_COMPLEXOBJ             0x13    /* Buffer, String, or package (Used by INDEX op only) */
+#define ARGI_REF_OR_STRING          0x14    /* Reference or String (Used by DEREFOF op only) */
+#define ARGI_REGION_OR_FIELD        0x15    /* Used by LOAD op only */
+
+/* Note: types above can expand to 0x1F maximum */
+
+#define ARGI_INVALID_OPCODE         0xFFFFFFFF
+
+
+/*
+ * hash offsets
+ */
+#define AML_EXTOP_HASH_OFFSET       22
+#define AML_LNOT_HASH_OFFSET        19
+
+
+/*
+ * opcode groups and types
+ */
+
+#define OPGRP_NAMED                 0x01
+#define OPGRP_FIELD                 0x02
+#define OPGRP_BYTELIST              0x04
+
+
+/*
+ * Opcode information
+ */
+
+/* Opcode flags */
+
+#define AML_HAS_ARGS                0x0800
+#define AML_HAS_TARGET              0x0400
+#define AML_HAS_RETVAL              0x0200
+#define AML_NSOBJECT                0x0100
+#define AML_NSOPCODE                0x0080
+#define AML_NSNODE                  0x0040
+#define AML_NAMED                   0x0020
+#define AML_DEFER                   0x0010
+#define AML_FIELD                   0x0008
+#define AML_CREATE                  0x0004
+#define AML_MATH                    0x0002
+#define AML_LOGICAL                 0x0001
+#define AML_CONSTANT                0x1000
+
+/* Convenient flag groupings */
+
+#define AML_FLAGS_EXEC_1A_0T_0R     AML_HAS_ARGS                                   /* Monadic1  */
+#define AML_FLAGS_EXEC_1A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL /* Monadic2  */
+#define AML_FLAGS_EXEC_1A_1T_0R     AML_HAS_ARGS | AML_HAS_TARGET
+#define AML_FLAGS_EXEC_1A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */
+#define AML_FLAGS_EXEC_2A_0T_0R     AML_HAS_ARGS                                   /* Dyadic1   */
+#define AML_FLAGS_EXEC_2A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL /* Dyadic2   */
+#define AML_FLAGS_EXEC_2A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r  */
+#define AML_FLAGS_EXEC_2A_2T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
+#define AML_FLAGS_EXEC_3A_0T_0R     AML_HAS_ARGS
+#define AML_FLAGS_EXEC_3A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
+#define AML_FLAGS_EXEC_6A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL
+
+
+/*
+ * The opcode Type is used in a dispatch table, do not change
+ * without updating the table.
+ */
+#define AML_TYPE_EXEC_1A_0T_0R      0x00 /* Monadic1  */
+#define AML_TYPE_EXEC_1A_0T_1R      0x01 /* Monadic2  */
+#define AML_TYPE_EXEC_1A_1T_0R      0x02
+#define AML_TYPE_EXEC_1A_1T_1R      0x03 /* monadic2_r */
+#define AML_TYPE_EXEC_2A_0T_0R      0x04 /* Dyadic1   */
+#define AML_TYPE_EXEC_2A_0T_1R      0x05 /* Dyadic2   */
+#define AML_TYPE_EXEC_2A_1T_1R      0x06 /* dyadic2_r  */
+#define AML_TYPE_EXEC_2A_2T_1R      0x07
+#define AML_TYPE_EXEC_3A_0T_0R      0x08
+#define AML_TYPE_EXEC_3A_1T_1R      0x09
+#define AML_TYPE_EXEC_6A_0T_1R      0x0A
+/* End of types used in dispatch table */
+
+#define AML_TYPE_LITERAL            0x0B
+#define AML_TYPE_CONSTANT           0x0C
+#define AML_TYPE_METHOD_ARGUMENT    0x0D
+#define AML_TYPE_LOCAL_VARIABLE     0x0E
+#define AML_TYPE_DATA_TERM          0x0F
+
+/* Generic for an op that returns a value */
+
+#define AML_TYPE_METHOD_CALL        0x10
+
+/* Misc */
+
+#define AML_TYPE_CREATE_FIELD       0x11
+#define AML_TYPE_CREATE_OBJECT      0x12
+#define AML_TYPE_CONTROL            0x13
+#define AML_TYPE_NAMED_NO_OBJ       0x14
+#define AML_TYPE_NAMED_FIELD        0x15
+#define AML_TYPE_NAMED_SIMPLE       0x16
+#define AML_TYPE_NAMED_COMPLEX      0x17
+#define AML_TYPE_RETURN             0x18
+
+#define AML_TYPE_UNDEFINED          0x19
+#define AML_TYPE_BOGUS              0x1A
+
+
+/*
+ * Opcode classes
+ */
+#define AML_CLASS_EXECUTE           0x00
+#define AML_CLASS_CREATE            0x01
+#define AML_CLASS_ARGUMENT          0x02
+#define AML_CLASS_NAMED_OBJECT      0x03
+#define AML_CLASS_CONTROL           0x04
+#define AML_CLASS_ASCII             0x05
+#define AML_CLASS_PREFIX            0x06
+#define AML_CLASS_INTERNAL          0x07
+#define AML_CLASS_RETURN_VALUE      0x08
+#define AML_CLASS_METHOD_CALL       0x09
+#define AML_CLASS_UNKNOWN           0x0A
+
+
+/* Predefined Operation Region space_iDs */
+
+typedef enum
+{
+       REGION_MEMORY                   = 0,
+       REGION_IO,
+       REGION_PCI_CONFIG,
+       REGION_EC,
+       REGION_SMBUS,
+       REGION_CMOS,
+       REGION_PCI_BAR,
+       REGION_DATA_TABLE,              /* Internal use only */
+       REGION_FIXED_HW                 = 0x7F
+
+} AML_REGION_TYPES;
+
+
+/* Comparison operation codes for match_op operator */
+
+typedef enum
+{
+       MATCH_MTR                       = 0,
+       MATCH_MEQ                       = 1,
+       MATCH_MLE                       = 2,
+       MATCH_MLT                       = 3,
+       MATCH_MGE                       = 4,
+       MATCH_MGT                       = 5
+
+} AML_MATCH_OPERATOR;
+
+#define MAX_MATCH_OPERATOR          5
+
+
+/*
+ * field_flags
+ *
+ * This byte is extracted from the AML and includes three separate
+ * pieces of information about the field:
+ * 1) The field access type
+ * 2) The field update rule
+ * 3) The lock rule for the field
+ *
+ * Bits 00 - 03 : access_type (any_acc, byte_acc, etc.)
+ *      04      : lock_rule (1 == Lock)
+ *      05 - 06 : update_rule
+ */
+#define AML_FIELD_ACCESS_TYPE_MASK  0x0F
+#define AML_FIELD_LOCK_RULE_MASK    0x10
+#define AML_FIELD_UPDATE_RULE_MASK  0x60
+
+
+/* 1) Field Access Types */
+
+typedef enum
+{
+       AML_FIELD_ACCESS_ANY            = 0x00,
+       AML_FIELD_ACCESS_BYTE           = 0x01,
+       AML_FIELD_ACCESS_WORD           = 0x02,
+       AML_FIELD_ACCESS_DWORD          = 0x03,
+       AML_FIELD_ACCESS_QWORD          = 0x04,    /* ACPI 2.0 */
+       AML_FIELD_ACCESS_BUFFER         = 0x05     /* ACPI 2.0 */
+
+} AML_ACCESS_TYPE;
+
+
+/* 2) Field Lock Rules */
+
+typedef enum
+{
+       AML_FIELD_LOCK_NEVER            = 0x00,
+       AML_FIELD_LOCK_ALWAYS           = 0x10
+
+} AML_LOCK_RULE;
+
+
+/* 3) Field Update Rules */
+
+typedef enum
+{
+       AML_FIELD_UPDATE_PRESERVE       = 0x00,
+       AML_FIELD_UPDATE_WRITE_AS_ONES  = 0x20,
+       AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
+
+} AML_UPDATE_RULE;
+
+
+/*
+ * Field Access Attributes.
+ * This byte is extracted from the AML via the
+ * access_as keyword
+ */
+typedef enum
+{
+       AML_FIELD_ATTRIB_SMB_QUICK      = 0x02,
+       AML_FIELD_ATTRIB_SMB_SEND_RCV   = 0x04,
+       AML_FIELD_ATTRIB_SMB_BYTE       = 0x06,
+       AML_FIELD_ATTRIB_SMB_WORD       = 0x08,
+       AML_FIELD_ATTRIB_SMB_BLOCK      = 0x0A,
+       AML_FIELD_ATTRIB_SMB_WORD_CALL  = 0x0C,
+       AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
+
+} AML_ACCESS_ATTRIBUTE;
+
+
+/* bit fields in method_flags byte */
+
+#define METHOD_FLAGS_ARG_COUNT      0x07
+#define METHOD_FLAGS_SERIALIZED     0x08
+#define METHOD_FLAGS_SYNCH_LEVEL    0xF0
+
+
+#endif /* __AMLCODE_H__ */
diff --git a/xen/include/acpi/amlresrc.h b/xen/include/acpi/amlresrc.h
new file mode 100644 (file)
index 0000000..b28b690
--- /dev/null
@@ -0,0 +1,329 @@
+
+/******************************************************************************
+ *
+ * Module Name: amlresrc.h - AML resource descriptors
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+#ifndef __AMLRESRC_H
+#define __AMLRESRC_H
+
+
+#define ASL_RESNAME_ADDRESS                     "_ADR"
+#define ASL_RESNAME_ALIGNMENT                   "_ALN"
+#define ASL_RESNAME_ADDRESSSPACE                "_ASI"
+#define ASL_RESNAME_BASEADDRESS                 "_BAS"
+#define ASL_RESNAME_BUSMASTER                   "_BM_"  /* Master(1), Slave(0) */
+#define ASL_RESNAME_DECODE                      "_DEC"
+#define ASL_RESNAME_DMA                         "_DMA"
+#define ASL_RESNAME_DMATYPE                     "_TYP"  /* Compatible(0), A(1), B(2), F(3) */
+#define ASL_RESNAME_GRANULARITY                 "_GRA"
+#define ASL_RESNAME_INTERRUPT                   "_INT"
+#define ASL_RESNAME_INTERRUPTLEVEL              "_LL_"  /* active_lo(1), active_hi(0) */
+#define ASL_RESNAME_INTERRUPTSHARE              "_SHR"  /* Shareable(1), no_share(0) */
+#define ASL_RESNAME_INTERRUPTTYPE               "_HE_"  /* Edge(1), Level(0) */
+#define ASL_RESNAME_LENGTH                      "_LEN"
+#define ASL_RESNAME_MEMATTRIBUTES               "_MTP"  /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
+#define ASL_RESNAME_MEMTYPE                     "_MEM"  /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
+#define ASL_RESNAME_MAXADDR                     "_MAX"
+#define ASL_RESNAME_MINADDR                     "_MIN"
+#define ASL_RESNAME_MAXTYPE                     "_MAF"
+#define ASL_RESNAME_MINTYPE                     "_MIF"
+#define ASL_RESNAME_REGISTERBITOFFSET           "_RBO"
+#define ASL_RESNAME_REGISTERBITWIDTH            "_RBW"
+#define ASL_RESNAME_RANGETYPE                   "_RNG"
+#define ASL_RESNAME_READWRITETYPE               "_RW_"  /* read_only(0), Writeable (1) */
+#define ASL_RESNAME_TRANSLATION                 "_TRA"
+#define ASL_RESNAME_TRANSTYPE                   "_TRS"  /* Sparse(1), Dense(0) */
+#define ASL_RESNAME_TYPE                        "_TTP"  /* Translation(1), Static (0) */
+#define ASL_RESNAME_XFERTYPE                    "_SIz"  /* 8(0), 8_and16(1), 16(2) */
+
+
+/* Default sizes for "small" resource descriptors */
+
+#define ASL_RDESC_IRQ_SIZE                      0x02
+#define ASL_RDESC_DMA_SIZE                      0x02
+#define ASL_RDESC_ST_DEPEND_SIZE                0x00
+#define ASL_RDESC_END_DEPEND_SIZE               0x00
+#define ASL_RDESC_IO_SIZE                       0x07
+#define ASL_RDESC_FIXED_IO_SIZE                 0x03
+#define ASL_RDESC_END_TAG_SIZE                  0x01
+
+
+struct asl_resource_node
+{
+       u32                                 buffer_length;
+       void                                *buffer;
+       struct asl_resource_node            *next;
+};
+
+
+/*
+ * Resource descriptors defined in the ACPI specification.
+ *
+ * Alignment must be BYTE because these descriptors
+ * are used to overlay the AML byte stream.
+ */
+#pragma pack(1)
+
+struct asl_irq_format_desc
+{
+       u8                                  descriptor_type;
+       u16                                 irq_mask;
+       u8                                  flags;
+};
+
+
+struct asl_irq_noflags_desc
+{
+       u8                                  descriptor_type;
+       u16                                 irq_mask;
+};
+
+
+struct asl_dma_format_desc
+{
+       u8                                  descriptor_type;
+       u8                                  dma_channel_mask;
+       u8                                  flags;
+};
+
+
+struct asl_start_dependent_desc
+{
+       u8                                  descriptor_type;
+       u8                                  flags;
+};
+
+
+struct asl_start_dependent_noprio_desc
+{
+       u8                                  descriptor_type;
+};
+
+
+struct asl_end_dependent_desc
+{
+       u8                                  descriptor_type;
+};
+
+
+struct asl_io_port_desc
+{
+       u8                                  descriptor_type;
+       u8                                  information;
+       u16                                 address_min;
+       u16                                 address_max;
+       u8                                  alignment;
+       u8                                  length;
+};
+
+
+struct asl_fixed_io_port_desc
+{
+       u8                                  descriptor_type;
+       u16                                 base_address;
+       u8                                  length;
+};
+
+
+struct asl_small_vendor_desc
+{
+       u8                                  descriptor_type;
+       u8                                  vendor_defined[7];
+};
+
+
+struct asl_end_tag_desc
+{
+       u8                                  descriptor_type;
+       u8                                  checksum;
+};
+
+
+/* LARGE descriptors */
+
+struct asl_memory_24_desc
+{
+       u8                                  descriptor_type;
+       u16                                 length;
+       u8                                  information;
+       u16                                 address_min;
+       u16                                 address_max;
+       u16                                 alignment;
+       u16                                 range_length;
+};
+
+
+struct asl_large_vendor_desc
+{
+       u8                                  descriptor_type;
+       u16                                 length;
+       u8                                  vendor_defined[1];
+};
+
+
+struct asl_memory_32_desc
+{
+       u8                                  descriptor_type;
+       u16                                 length;
+       u8                                  information;
+       u32                                 address_min;
+       u32                                 address_max;
+       u32                                 alignment;
+       u32                                 range_length;
+};
+
+
+struct asl_fixed_memory_32_desc
+{
+       u8                                  descriptor_type;
+       u16                                 length;
+       u8                                  information;
+       u32                                 base_address;
+       u32                                 range_length;
+};
+
+
+struct asl_qword_address_desc
+{
+       u8                                  descriptor_type;
+       u16                                 length;
+       u8                                  resource_type;
+       u8                                  flags;
+       u8                                  specific_flags;
+       u64                                 granularity;
+       u64                                 address_min;
+       u64                                 address_max;
+       u64                                 translation_offset;
+       u64                                 address_length;
+       u8                                  optional_fields[2];
+};
+
+
+struct asl_dword_address_desc
+{
+       u8                                  descriptor_type;
+       u16                                 length;
+       u8                                  resource_type;
+       u8                                  flags;
+       u8                                  specific_flags;
+       u32                                 granularity;
+       u32                                 address_min;
+       u32                                 address_max;
+       u32                                 translation_offset;
+       u32                                 address_length;
+       u8                                  optional_fields[2];
+};
+
+
+struct asl_word_address_desc
+{
+       u8                                  descriptor_type;
+       u16                                 length;
+       u8                                  resource_type;
+       u8                                  flags;
+       u8                                  specific_flags;
+       u16                                 granularity;
+       u16                                 address_min;
+       u16                                 address_max;
+       u16                                 translation_offset;
+       u16                                 address_length;
+       u8                                  optional_fields[2];
+};
+
+
+struct asl_extended_xrupt_desc
+{
+       u8                                  descriptor_type;
+       u16                                 length;
+       u8                                  flags;
+       u8                                  table_length;
+       u32                                 interrupt_number[1];
+       /* res_source_index, res_source optional fields follow */
+};
+
+
+struct asl_general_register_desc
+{
+       u8                                  descriptor_type;
+       u16                                 length;
+       u8                                  address_space_id;
+       u8                                  bit_width;
+       u8                                  bit_offset;
+       u8                                  reserved;
+       u64                                 address;
+};
+
+/* restore default alignment */
+
+#pragma pack()
+
+/* Union of all resource descriptors, sow we can allocate the worst case */
+
+union asl_resource_desc
+{
+       struct asl_irq_format_desc          irq;
+       struct asl_dma_format_desc          dma;
+       struct asl_start_dependent_desc     std;
+       struct asl_end_dependent_desc       end;
+       struct asl_io_port_desc             iop;
+       struct asl_fixed_io_port_desc       fio;
+       struct asl_small_vendor_desc        smv;
+       struct asl_end_tag_desc             et;
+
+       struct asl_memory_24_desc           M24;
+       struct asl_large_vendor_desc        lgv;
+       struct asl_memory_32_desc           M32;
+       struct asl_fixed_memory_32_desc     F32;
+       struct asl_qword_address_desc       qas;
+       struct asl_dword_address_desc       das;
+       struct asl_word_address_desc        was;
+       struct asl_extended_xrupt_desc      exx;
+       struct asl_general_register_desc    grg;
+       u32                                 u32_item;
+       u16                                 u16_item;
+       u8                                  U8item;
+};
+
+
+#endif
+
diff --git a/xen/include/acpi/platform/acenv.h b/xen/include/acpi/platform/acenv.h
new file mode 100644 (file)
index 0000000..9a0cd41
--- /dev/null
@@ -0,0 +1,367 @@
+/******************************************************************************
+ *
+ * Name: acenv.h - Generation environment specific items
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACENV_H__
+#define __ACENV_H__
+
+
+/*
+ * Configuration for ACPI tools and utilities
+ */
+
+#ifdef _ACPI_DUMP_APP
+#ifndef MSDOS
+#define ACPI_DEBUG_OUTPUT
+#endif
+#define ACPI_APPLICATION
+#define ACPI_DISASSEMBLER
+#define ACPI_NO_METHOD_EXECUTION
+#define ACPI_USE_SYSTEM_CLIBRARY
+#endif
+
+#ifdef _ACPI_EXEC_APP
+#undef DEBUGGER_THREADING
+#define DEBUGGER_THREADING      DEBUGGER_SINGLE_THREADED
+#define ACPI_DEBUG_OUTPUT
+#define ACPI_APPLICATION
+#define ACPI_DEBUGGER
+#define ACPI_DISASSEMBLER
+#define ACPI_USE_SYSTEM_CLIBRARY
+#endif
+
+#ifdef _ACPI_ASL_COMPILER
+#define ACPI_DEBUG_OUTPUT
+#define ACPI_APPLICATION
+#define ACPI_DISASSEMBLER
+#define ACPI_CONSTANT_EVAL_ONLY
+#define ACPI_USE_SYSTEM_CLIBRARY
+#endif
+
+/*
+ * Environment configuration.  The purpose of this file is to interface to the
+ * local generation environment.
+ *
+ * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
+ *      Otherwise, local versions of string/memory functions will be used.
+ * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and
+ *      the standard header files may be used.
+ *
+ * The ACPI subsystem only uses low level C library functions that do not call
+ * operating system services and may therefore be inlined in the code.
+ *
+ * It may be necessary to tailor these include files to the target
+ * generation environment.
+ *
+ *
+ * Functions and constants used from each header:
+ *
+ * string.h:    memcpy
+ *              memset
+ *              strcat
+ *              strcmp
+ *              strcpy
+ *              strlen
+ *              strncmp
+ *              strncat
+ *              strncpy
+ *
+ * stdlib.h:    strtoul
+ *
+ * stdarg.h:    va_list
+ *              va_arg
+ *              va_start
+ *              va_end
+ *
+ */
+
+/*! [Begin] no source code translation */
+
+#if defined(__linux__)
+#include "aclinux.h"
+
+#elif defined(_AED_EFI)
+#include "acefi.h"
+
+#elif defined(WIN32)
+#include "acwin.h"
+
+#elif defined(WIN64)
+#include "acwin64.h"
+
+#elif defined(MSDOS)        /* Must appear after WIN32 and WIN64 check */
+#include "acdos16.h"
+
+#elif defined(__FreeBSD__)
+#include "acfreebsd.h"
+
+#elif defined(__NetBSD__)
+#include "acnetbsd.h"
+
+#elif defined(MODESTO)
+#include "acmodesto.h"
+
+#elif defined(NETWARE)
+#include "acnetware.h"
+
+#else
+
+/* All other environments */
+
+#define ACPI_USE_STANDARD_HEADERS
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+
+/* Name of host operating system (returned by the _OS_ namespace object) */
+
+#define ACPI_OS_NAME         "Intel ACPI/CA Core Subsystem"
+
+/* This macro is used to tag functions as "printf-like" because
+ * some compilers can catch printf format string problems. MSVC
+ * doesn't, so this is proprocessed away.
+ */
+#define ACPI_PRINTF_LIKE_FUNC
+
+#endif
+
+/*
+ * Memory allocation tracking.  Used only if
+ * 1) This is the debug version
+ * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
+ */
+#ifdef ACPI_DEBUG_OUTPUT
+#if ACPI_MACHINE_WIDTH != 16
+#define ACPI_DBG_TRACK_ALLOCATIONS
+#endif
+#endif
+
+/*! [End] no source code translation !*/
+
+
+/*
+ * Debugger threading model
+ * Use single threaded if the entire subsystem is contained in an application
+ * Use multiple threaded when the subsystem is running in the kernel.
+ *
+ * By default the model is single threaded if ACPI_APPLICATION is set,
+ * multi-threaded if ACPI_APPLICATION is not set.
+ */
+#define DEBUGGER_SINGLE_THREADED    0
+#define DEBUGGER_MULTI_THREADED     1
+
+#ifndef DEBUGGER_THREADING
+#ifdef ACPI_APPLICATION
+#define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
+
+#else
+#define DEBUGGER_THREADING          DEBUGGER_MULTI_THREADED
+#endif
+#endif /* !DEBUGGER_THREADING */
+
+/******************************************************************************
+ *
+ * C library configuration
+ *
+ *****************************************************************************/
+
+#ifdef ACPI_USE_SYSTEM_CLIBRARY
+/*
+ * Use the standard C library headers.
+ * We want to keep these to a minimum.
+ */
+
+#ifdef ACPI_USE_STANDARD_HEADERS
+/*
+ * Use the standard headers from the standard locations
+ */
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#endif /* ACPI_USE_STANDARD_HEADERS */
+
+/*
+ * We will be linking to the standard Clib functions
+ */
+
+#define ACPI_STRSTR(s1,s2)      strstr((s1), (s2))
+#define ACPI_STRUPR(s)          (void) acpi_ut_strupr ((s))
+#define ACPI_STRLEN(s)          (acpi_size) strlen((s))
+#define ACPI_STRCPY(d,s)        (void) strcpy((d), (s))
+#define ACPI_STRNCPY(d,s,n)     (void) strncpy((d), (s), (acpi_size)(n))
+#define ACPI_STRNCMP(d,s,n)     strncmp((d), (s), (acpi_size)(n))
+#define ACPI_STRCMP(d,s)        strcmp((d), (s))
+#define ACPI_STRCAT(d,s)        (void) strcat((d), (s))
+#define ACPI_STRNCAT(d,s,n)     strncat((d), (s), (acpi_size)(n))
+#define ACPI_STRTOUL(d,s,n)     strtoul((d), (s), (acpi_size)(n))
+#define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (acpi_size)(n))
+#define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (acpi_size)(n))
+
+#define ACPI_TOUPPER            toupper
+#define ACPI_TOLOWER            tolower
+#define ACPI_IS_XDIGIT          isxdigit
+#define ACPI_IS_DIGIT           isdigit
+#define ACPI_IS_SPACE           isspace
+#define ACPI_IS_UPPER           isupper
+#define ACPI_IS_PRINT           isprint
+#define ACPI_IS_ALPHA           isalpha
+#define ACPI_IS_ASCII           isascii
+
+/******************************************************************************
+ *
+ * Not using native C library, use local implementations
+ *
+ *****************************************************************************/
+#else
+
+/*
+ * Use local definitions of C library macros and functions
+ * NOTE: The function implementations may not be as efficient
+ * as an inline or assembly code implementation provided by a
+ * native C library.
+ */
+
+#ifndef va_arg
+
+#ifndef _VALIST
+#define _VALIST
+typedef char *va_list;
+#endif /* _VALIST */
+
+/*
+ * Storage alignment properties
+ */
+
+#define  _AUPBND                (sizeof (acpi_native_int) - 1)
+#define  _ADNBND                (sizeof (acpi_native_int) - 1)
+
+/*
+ * Variable argument list macro definitions
+ */
+
+#define _bnd(X, bnd)            (((sizeof (X)) + (bnd)) & (~(bnd)))
+#define va_arg(ap, T)           (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
+#define va_end(ap)              (void) 0
+#define va_start(ap, A)         (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
+
+#endif /* va_arg */
+
+
+#define ACPI_STRSTR(s1,s2)      acpi_ut_strstr ((s1), (s2))
+#define ACPI_STRUPR(s)          (void) acpi_ut_strupr ((s))
+#define ACPI_STRLEN(s)          (acpi_size) acpi_ut_strlen ((s))
+#define ACPI_STRCPY(d,s)        (void) acpi_ut_strcpy ((d), (s))
+#define ACPI_STRNCPY(d,s,n)     (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n))
+#define ACPI_STRNCMP(d,s,n)     acpi_ut_strncmp ((d), (s), (acpi_size)(n))
+#define ACPI_STRCMP(d,s)        acpi_ut_strcmp ((d), (s))
+#define ACPI_STRCAT(d,s)        (void) acpi_ut_strcat ((d), (s))
+#define ACPI_STRNCAT(d,s,n)     acpi_ut_strncat ((d), (s), (acpi_size)(n))
+#define ACPI_STRTOUL(d,s,n)     acpi_ut_strtoul ((d), (s), (acpi_size)(n))
+#define ACPI_MEMCPY(d,s,n)      (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n))
+#define ACPI_MEMSET(d,v,n)      (void) acpi_ut_memset ((d), (v), (acpi_size)(n))
+#define ACPI_TOUPPER            acpi_ut_to_upper
+#define ACPI_TOLOWER            acpi_ut_to_lower
+
+#endif /* ACPI_USE_SYSTEM_CLIBRARY */
+
+
+/******************************************************************************
+ *
+ * Assembly code macros
+ *
+ *****************************************************************************/
+
+/*
+ * Handle platform- and compiler-specific assembly language differences.
+ * These should already have been defined by the platform includes above.
+ *
+ * Notes:
+ * 1) Interrupt 3 is used to break into a debugger
+ * 2) Interrupts are turned off during ACPI register setup
+ */
+
+/* Unrecognized compiler, use defaults */
+
+#ifndef ACPI_ASM_MACROS
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+#define ACPI_ASM_MACROS
+#define BREAKPOINT3
+#define ACPI_DISABLE_IRQS()
+#define ACPI_ENABLE_IRQS()
+#define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
+#define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
+
+#endif /* ACPI_ASM_MACROS */
+
+
+#ifdef ACPI_APPLICATION
+
+/* Don't want software interrupts within a ring3 application */
+
+#undef BREAKPOINT3
+#define BREAKPOINT3
+#endif
+
+
+/******************************************************************************
+ *
+ * Compiler-specific information is contained in the compiler-specific
+ * headers.
+ *
+ *****************************************************************************/
+#endif /* __ACENV_H__ */
diff --git a/xen/include/acpi/platform/acgcc.h b/xen/include/acpi/platform/acgcc.h
new file mode 100644 (file)
index 0000000..61abbc3
--- /dev/null
@@ -0,0 +1,59 @@
+/******************************************************************************
+ *
+ * Name: acgcc.h - GCC specific defines, etc.
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACGCC_H__
+#define __ACGCC_H__
+
+/* This macro is used to tag functions as "printf-like" because
+ * some compilers (like GCC) can catch printf format string problems.
+ */
+#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5)))
+
+/* Some compilers complain about unused variables. Sometimes we don't want to
+ * use all the variables (most specifically for _THIS_MODULE). This allow us
+ * to to tell the compiler warning in a per-variable manner that a variable
+ * is unused.
+ */
+#define ACPI_UNUSED_VAR __attribute__ ((unused))
+
+#endif /* __ACGCC_H__ */
diff --git a/xen/include/acpi/platform/aclinux.h b/xen/include/acpi/platform/aclinux.h
new file mode 100644 (file)
index 0000000..241385e
--- /dev/null
@@ -0,0 +1,92 @@
+/******************************************************************************
+ *
+ * Name: aclinux.h - OS specific defines, etc.
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2004, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACLINUX_H__
+#define __ACLINUX_H__
+
+#define ACPI_OS_NAME                "Linux"
+
+#define ACPI_USE_SYSTEM_CLIBRARY
+#define ACPI_USE_DO_WHILE_0
+
+#ifdef __KERNEL__
+
+#include <xen/config.h>
+#include <xen/string.h>
+#include <xen/kernel.h>
+#include <xen/ctype.h>
+#include <asm/system.h>
+#include <asm/atomic.h>
+#include <asm/div64.h>
+#include <asm/acpi.h>
+
+#define strtoul simple_strtoul
+
+#define ACPI_MACHINE_WIDTH  BITS_PER_LONG
+
+#else /* !__KERNEL__ */
+
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <unistd.h>
+
+#if defined(__ia64__) || defined(__x86_64__)
+#define ACPI_MACHINE_WIDTH          64
+#define COMPILER_DEPENDENT_INT64    long
+#define COMPILER_DEPENDENT_UINT64   unsigned long
+#else
+#define ACPI_MACHINE_WIDTH          32
+#define COMPILER_DEPENDENT_INT64    long long
+#define COMPILER_DEPENDENT_UINT64   unsigned long long
+#define ACPI_USE_NATIVE_DIVIDE
+#endif
+
+#endif /* __KERNEL__ */
+
+/* Linux uses GCC */
+
+#include "acgcc.h"
+
+#endif /* __ACLINUX_H__ */
diff --git a/xen/include/asm-i386/acpi.h b/xen/include/asm-i386/acpi.h
new file mode 100644 (file)
index 0000000..4d750d4
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ *  asm-i386/acpi.h
+ *
+ *  Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *  Copyright (C) 2001 Patrick Mochel <mochel@osdl.org>
+  *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#ifndef _ASM_ACPI_H
+#define _ASM_ACPI_H
+
+#ifdef __KERNEL__
+
+#define COMPILER_DEPENDENT_INT64   long long
+#define COMPILER_DEPENDENT_UINT64  unsigned long long
+
+/*
+ * Calling conventions:
+ *
+ * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)
+ * ACPI_EXTERNAL_XFACE      - External ACPI interfaces 
+ * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces
+ * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces
+ */
+#define ACPI_SYSTEM_XFACE
+#define ACPI_EXTERNAL_XFACE
+#define ACPI_INTERNAL_XFACE
+#define ACPI_INTERNAL_VAR_XFACE
+
+/* Asm macros */
+
+#define ACPI_ASM_MACROS
+#define BREAKPOINT3
+#define ACPI_DISABLE_IRQS() __cli()
+#define ACPI_ENABLE_IRQS()  __sti()
+#define ACPI_FLUSH_CPU_CACHE() wbinvd()
+
+/*
+ * A brief explanation as GNU inline assembly is a bit hairy
+ *  %0 is the output parameter in EAX ("=a")
+ *  %1 and %2 are the input parameters in ECX ("c")
+ *  and an immediate value ("i") respectively
+ *  All actual register references are preceded with "%%" as in "%%edx"
+ *  Immediate values in the assembly are preceded by "$" as in "$0x1"
+ *  The final asm parameter are the operation altered non-output registers.
+ */
+#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
+    do { \
+        int dummy; \
+        asm("1:     movl (%1),%%eax;" \
+            "movl   %%eax,%%edx;" \
+            "andl   %2,%%edx;" \
+            "btsl   $0x1,%%edx;" \
+            "adcl   $0x0,%%edx;" \
+            "lock;  cmpxchgl %%edx,(%1);" \
+            "jnz    1b;" \
+            "cmpb   $0x3,%%dl;" \
+            "sbbl   %%eax,%%eax" \
+            :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
+    } while(0)
+
+#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
+    do { \
+        int dummy; \
+        asm("1:     movl (%1),%%eax;" \
+            "movl   %%eax,%%edx;" \
+            "andl   %2,%%edx;" \
+            "lock;  cmpxchgl %%edx,(%1);" \
+            "jnz    1b;" \
+            "andl   $0x1,%%eax" \
+            :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
+    } while(0)
+
+
+/*
+ * Math helper asm macros
+ */
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+        asm("divl %2;"        \
+        :"=a"(q32), "=d"(r32) \
+        :"r"(d32),            \
+        "0"(n_lo), "1"(n_hi))
+
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+    asm("shrl   $1,%2;"             \
+        "rcrl   $1,%3;"             \
+        :"=r"(n_hi), "=r"(n_lo)     \
+        :"0"(n_hi), "1"(n_lo))
+
+
+#ifdef CONFIG_ACPI_BOOT 
+extern int acpi_lapic;
+extern int acpi_ioapic;
+extern int acpi_noirq;
+
+/* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */
+#define FIX_ACPI_PAGES 4
+
+#else  /* !CONFIG_ACPI_BOOT */
+#  define acpi_lapic 0
+#  define acpi_ioapic 0
+
+#endif /* !CONFIG_ACPI_BOOT */
+
+#ifdef CONFIG_ACPI_PCI
+static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
+extern int acpi_irq_balance_set(char *str);
+#else
+static inline void acpi_noirq_set(void) { }
+static inline int acpi_irq_balance_set(char *str) { return 0; }
+#endif
+
+#ifdef CONFIG_ACPI_SLEEP
+
+extern unsigned long saved_eip;
+extern unsigned long saved_esp;
+extern unsigned long saved_ebp;
+extern unsigned long saved_ebx;
+extern unsigned long saved_esi;
+extern unsigned long saved_edi;
+
+static inline void acpi_save_register_state(unsigned long return_point)
+{
+       saved_eip = return_point;
+       asm volatile ("movl %%esp,(%0)" : "=m" (saved_esp));
+       asm volatile ("movl %%ebp,(%0)" : "=m" (saved_ebp));
+       asm volatile ("movl %%ebx,(%0)" : "=m" (saved_ebx));
+       asm volatile ("movl %%edi,(%0)" : "=m" (saved_edi));
+       asm volatile ("movl %%esi,(%0)" : "=m" (saved_esi));
+}
+
+#define acpi_restore_register_state()   do {} while (0)
+
+
+/* routines for saving/restoring kernel state */
+extern int acpi_save_state_mem(void);
+extern int acpi_save_state_disk(void);
+extern void acpi_restore_state_mem(void);
+
+extern unsigned long acpi_wakeup_address;
+
+extern void do_suspend_lowlevel_s4bios(int resume);
+
+/* early initialization routine */
+extern void acpi_reserve_bootmem(void);
+
+#endif /*CONFIG_ACPI_SLEEP*/
+
+
+#endif /*__KERNEL__*/
+
+#endif /*_ASM_ACPI_H*/
index f2f6f9091d5e51674bf2491e7af3c67181579aad..f97e0b32d8fc79aa234783767decb29ada321c07 100644 (file)
@@ -64,14 +64,17 @@ static inline void ack_APIC_irq(void)
 }
 
 extern int get_maxlvt(void);
+extern void clear_local_APIC(void);
 extern void connect_bsp_APIC (void);
 extern void disconnect_bsp_APIC (void);
 extern void disable_local_APIC (void);
 extern int verify_local_APIC (void);
+extern void cache_APIC_registers (void);
 extern void sync_Arb_IDs (void);
 extern void init_bsp_APIC (void);
 extern void setup_local_APIC (void);
 extern void init_apic_mappings (void);
+extern void smp_local_timer_interrupt (struct pt_regs * regs);
 extern void setup_APIC_clocks (void);
 extern void setup_apic_nmi_watchdog (void);
 extern inline void nmi_watchdog_tick (struct pt_regs * regs);
@@ -79,8 +82,8 @@ extern int APIC_init_uniprocessor (void);
 extern void disable_APIC_timer(void);
 extern void enable_APIC_timer(void);
 
-//extern struct pm_dev *apic_pm_register(pm_dev_t, unsigned long, pm_callback);
-//extern void apic_pm_unregister(struct pm_dev*);
+/*extern struct pm_dev *apic_pm_register(pm_dev_t, unsigned long, pm_callback);*/
+/*extern void apic_pm_unregister(struct pm_dev*);*/
 
 extern unsigned int watchdog_on;
 
index 227bfca6528aacb632167142b021dba81867c03e..9f07409b3ff1519b8ffc5bc30712639b92a8da69 100644 (file)
@@ -18,6 +18,7 @@
 #define                        GET_APIC_VERSION(x)     ((x)&0xFF)
 #define                        GET_APIC_MAXLVT(x)      (((x)>>16)&0xFF)
 #define                        APIC_INTEGRATED(x)      ((x)&0xF0)
+#define                        APIC_XAPIC_SUPPORT(x)   ((x)>=0x14)
 #define                APIC_TASKPRI    0x80
 #define                        APIC_TPRI_MASK          0xFF
 #define                APIC_ARBPRI     0x90
index 3310934fe2f679d51db3fb41c834b20cd8fa07d8..28dd1e3e68ba6d97997e40ee8000404e53cef28f 100644 (file)
@@ -14,6 +14,9 @@
 #define CONFIG_X86_IO_APIC 1
 #define CONFIG_X86_L1_CACHE_SHIFT 5
 
+#define CONFIG_ACPI 1
+#define CONFIG_ACPI_BOOT 1
+
 #define CONFIG_PCI 1
 #define CONFIG_PCI_BIOS 1
 #define CONFIG_PCI_DIRECT 1
index 85b8b43974de0ba180214b72bdc214c0052cd418..f78a86891e1802236db735f7eb654af43643c4df 100644 (file)
@@ -10,9 +10,9 @@
 /* Sample usage: CPU_FEATURE_P(cpu.x86_capability, FPU) */
 #define CPU_FEATURE_P(CAP, FEATURE) test_bit(CAP, X86_FEATURE_##FEATURE ##_BIT)
 
-#define NCAPINTS       4       /* Currently we have 4 32-bit words worth of info */
+#define NCAPINTS       6       /* Currently we have 6 32-bit words worth of info */
 
-/* Intel-defined CPU features, CPUID level 0x00000001, word 0 */
+/* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */
 #define X86_FEATURE_FPU                (0*32+ 0) /* Onboard FPU */
 #define X86_FEATURE_VME                (0*32+ 1) /* Virtual Mode Extensions */
 #define X86_FEATURE_DE         (0*32+ 2) /* Debugging Extensions */
@@ -47,6 +47,7 @@
 /* AMD-defined CPU features, CPUID level 0x80000001, word 1 */
 /* Don't duplicate feature flags which are redundant with Intel! */
 #define X86_FEATURE_SYSCALL    (1*32+11) /* SYSCALL/SYSRET */
+#define X86_FEATURE_MP         (1*32+19) /* MP Capable. */
 #define X86_FEATURE_MMXEXT     (1*32+22) /* AMD MMX extensions */
 #define X86_FEATURE_LM         (1*32+29) /* Long Mode (x86-64) */
 #define X86_FEATURE_3DNOWEXT   (1*32+30) /* AMD 3DNow! extensions */
 #define X86_FEATURE_K6_MTRR    (3*32+ 1) /* AMD K6 nonstandard MTRRs */
 #define X86_FEATURE_CYRIX_ARR  (3*32+ 2) /* Cyrix ARRs (= MTRRs) */
 #define X86_FEATURE_CENTAUR_MCR        (3*32+ 3) /* Centaur MCRs (= MTRRs) */
+/* cpu types for specific tunings: */
+#define X86_FEATURE_K8         (3*32+ 4) /* Opteron, Athlon64 */
+#define X86_FEATURE_K7         (3*32+ 5) /* Athlon */
+#define X86_FEATURE_P3         (3*32+ 6) /* P3 */
+#define X86_FEATURE_P4         (3*32+ 7) /* P4 */
+
+/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
+#define X86_FEATURE_EST                (4*32+ 7) /* Enhanced SpeedStep */
+
+/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
+#define X86_FEATURE_XSTORE     (5*32+ 2) /* on-CPU RNG present (xstore insn) */
+
 
 #define cpu_has(c, bit)                test_bit(bit, (c)->x86_capability)
+#define boot_cpu_has(bit)      test_bit(bit, boot_cpu_data.x86_capability)
+
+#define cpu_has_fpu            boot_cpu_has(X86_FEATURE_FPU)
+#define cpu_has_vme            boot_cpu_has(X86_FEATURE_VME)
+#define cpu_has_de             boot_cpu_has(X86_FEATURE_DE)
+#define cpu_has_pse            boot_cpu_has(X86_FEATURE_PSE)
+#define cpu_has_tsc            boot_cpu_has(X86_FEATURE_TSC)
+#define cpu_has_pae            boot_cpu_has(X86_FEATURE_PAE)
+#define cpu_has_pge            boot_cpu_has(X86_FEATURE_PGE)
+#define cpu_has_sse2           boot_cpu_has(X86_FEATURE_XMM2)
+#define cpu_has_apic           boot_cpu_has(X86_FEATURE_APIC)
+#define cpu_has_sep            boot_cpu_has(X86_FEATURE_SEP)
+#define cpu_has_mtrr           boot_cpu_has(X86_FEATURE_MTRR)
+#define cpu_has_mmx            boot_cpu_has(X86_FEATURE_MMX)
+#define cpu_has_fxsr           boot_cpu_has(X86_FEATURE_FXSR)
+#define cpu_has_xmm            boot_cpu_has(X86_FEATURE_XMM)
+#define cpu_has_ht             boot_cpu_has(X86_FEATURE_HT)
+#define cpu_has_mp             boot_cpu_has(X86_FEATURE_MP)
+#define cpu_has_k6_mtrr                boot_cpu_has(X86_FEATURE_K6_MTRR)
+#define cpu_has_cyrix_arr      boot_cpu_has(X86_FEATURE_CYRIX_ARR)
+#define cpu_has_centaur_mcr    boot_cpu_has(X86_FEATURE_CENTAUR_MCR)
+#define cpu_has_xstore         boot_cpu_has(X86_FEATURE_XSTORE)
 
 #endif /* __ASM_I386_CPUFEATURE_H */
 
diff --git a/xen/include/asm-i386/div64.h b/xen/include/asm-i386/div64.h
new file mode 100644 (file)
index 0000000..ef915df
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef __I386_DIV64
+#define __I386_DIV64
+
+#define do_div(n,base) ({ \
+       unsigned long __upper, __low, __high, __mod; \
+       asm("":"=a" (__low), "=d" (__high):"A" (n)); \
+       __upper = __high; \
+       if (__high) { \
+               __upper = __high % (base); \
+               __high = __high / (base); \
+       } \
+       asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (base), "0" (__low), "1" (__upper)); \
+       asm("":"=A" (n):"a" (__low),"d" (__high)); \
+       __mod; \
+})
+
+#endif
index e0854628d3d04a09937f026fbf179ef802bd3fb0..2d0af853060f3836821436652a9d51f335622d83 100644 (file)
 
 #define MAX_DMA_CHANNELS       8
 
-#if 0
 /* The maximum address that we can perform a DMA transfer to on this platform */
-#define MAX_DMA_ADDRESS      (PAGE_OFFSET+0x1000000)
-#endif
-
+/*#define MAX_DMA_ADDRESS      (PAGE_OFFSET+0x1000000)*/
 
 /* 8237 DMA controllers */
 #define IO_DMA1_BASE   0x00    /* 8 bit slave DMA, channels 0..3 */
@@ -242,7 +239,7 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
 }
 
 
-/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for
+/* Set transfer size (max 64k for DMA0..3, 128k for DMA5..7) for
  * a specific DMA channel.
  * You must ensure the parameters are valid.
  * NOTE: from a manual: "the number of transfers is one more
index 12e7403899ed43f195bb8f47dd309073a3bcbba5..fcfa97aee95c84e73d4de9a8de5cc9da36327a15 100644 (file)
@@ -14,6 +14,7 @@
 #define _ASM_FIXMAP_H
 
 #include <xen/config.h>
+#include <asm/acpi.h>
 #include <asm/apicdef.h>
 #include <asm/page.h>
 
@@ -53,6 +54,10 @@ enum fixed_addresses {
 #ifdef CONFIG_HIGHMEM
        FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
        FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
+#endif
+#ifdef CONFIG_ACPI_BOOT
+       FIX_ACPI_BEGIN,
+       FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
 #endif
        __end_of_fixed_addresses
 };
index c59f6e3e0f5ea0ae1c70d0fa50dfb841daea826b..5b3cb77c914dbe217db75b5e338616416d2e709b 100644 (file)
@@ -57,7 +57,7 @@ static inline void release_irqlock(int cpu)
 {
        /* if we didn't own the irq lock, just ignore.. */
        if (global_irq_holder == (unsigned char) cpu) {
-               global_irq_holder = 0xff;
+               global_irq_holder = NO_PROC_ID;
                clear_bit(0,&global_irq_lock);
        }
 }
@@ -66,6 +66,8 @@ static inline void irq_enter(int cpu, int irq)
 {
        ++local_irq_count(cpu);
 
+       smp_mb();
+
        while (test_bit(0,&global_irq_lock)) {
                cpu_relax();
        }
index 1ad5c073941c8c9ae5a25f82393597061dceb285..2c4ca680f68bc38b38d366f39f178b00a242f478 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef __ASMi386_HDREG_H
 #define __ASMi386_HDREG_H
 
-typedef unsigned short ide_ioreg_t;
+//typedef unsigned short ide_ioreg_t;
+typedef unsigned long ide_ioreg_t;
 
 #endif /* __ASMi386_HDREG_H */
index a2d412c43b40a1af16d8f38849c1b4d0492411bb..8b948758918b643b066e503bb07023a75aa3a53c 100644 (file)
  * The structure of the IO-APIC:
  */
 struct IO_APIC_reg_00 {
-       __u32   __reserved_2    : 24,
+       __u32   __reserved_2    : 14,
+               LTS             :  1,
+               delivery_type   :  1,
+               __reserved_1    :  8,
                ID              :  4,
-               __reserved_1    :  4;
+               __reserved_0    :  4;
 } __attribute__ ((packed));
 
 struct IO_APIC_reg_01 {
@@ -41,6 +44,11 @@ struct IO_APIC_reg_02 {
                __reserved_1    :  4;
 } __attribute__ ((packed));
 
+struct IO_APIC_reg_03 {
+       __u32   boot_DT         : 1,
+               __reserved_1    : 31;
+} __attribute__ ((packed));
+
 /*
  * # of IO-APICs and # of IRQ routing registers
  */
@@ -114,15 +122,6 @@ static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned i
        *(IO_APIC_BASE(apic)+4) = value;
 }
 
-/*
- * Re-write a value: to be used for read-modify-write
- * cycles where the read already set up the index register.
- */
-static inline void io_apic_modify(unsigned int apic, unsigned int value)
-{
-       *(IO_APIC_BASE(apic)+4) = value;
-}
-
 /*
  * Synchronize the IO-APIC and the CPU by doing
  * a dummy read from the IO-APIC
@@ -132,17 +131,37 @@ static inline void io_apic_sync(unsigned int apic)
        (void) *(IO_APIC_BASE(apic)+4);
 }
 
-/* 1 if "noapic" boot option passed */
-extern int skip_ioapic_setup;
-
 /*
  * If we use the IO-APIC for IRQ routing, disable automatic
  * assignment of PCI IRQ's.
  */
 #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup)
 
-#else  /* !CONFIG_X86_IO_APIC */
-#define io_apic_assign_pci_irqs 0
+#ifdef CONFIG_ACPI_BOOT
+extern int io_apic_get_unique_id (int ioapic, int apic_id);
+extern int io_apic_get_version (int ioapic);
+extern int io_apic_get_redir_entries (int ioapic);
+extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low);
 #endif
 
+extern int skip_ioapic_setup;  /* 1 for "noapic" */
+
+static inline void disable_ioapic_setup(void)
+{
+       skip_ioapic_setup = 1;
+}
+
+static inline int ioapic_setup_disabled(void)
+{
+       return skip_ioapic_setup;
+}
+
+#else  /* !CONFIG_X86_IO_APIC */
+#define io_apic_assign_pci_irqs 0
+
+static inline void disable_ioapic_setup(void)
+{ }
+
+#endif /* !CONFIG_X86_IO_APIC */
+
 #endif
index 7ca70f41a80c6f5b0059df9b98474a99dd553618..7a20710c2a1e735d29b934a571c970433efb4ae8 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __ASM_MPSPEC_H
 #define __ASM_MPSPEC_H
 
+#include <xen/config.h>
+#include <xen/types.h>
 
 /*
  * Structure definitions for SMP machines following the
@@ -206,12 +208,35 @@ extern int *mp_bus_id_to_pci_bus;
 extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
 
 extern unsigned int boot_cpu_physical_apicid;
+/*extern unsigned long phys_cpu_present_map;*/
 extern int smp_found_config;
 extern void find_smp_config (void);
 extern void get_smp_config (void);
+/*extern int nr_ioapics;*/
 extern int apic_version [MAX_APICS];
+/*extern int mp_irq_entries;*/
+/*extern struct mpc_config_intsrc *mp_irqs;*/
+/*extern int mpc_default_type;*/
 extern int mp_current_pci_id;
 extern unsigned long mp_lapic_addr;
+/*extern int pic_mode;*/
+extern int using_apic_timer;
+
+#ifdef CONFIG_ACPI_BOOT
+extern void mp_register_lapic (u8 id, u8 enabled);
+extern void mp_register_lapic_address (u64 address);
+
+#ifdef CONFIG_X86_IO_APIC
+extern void mp_register_ioapic (u8 id, u32 address, u32 irq_base);
+extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 global_irq);
+extern void mp_config_acpi_legacy_irqs (void);
+extern void mp_config_ioapic_for_sci(int irq);
+extern void mp_parse_prt (void);
+#else /*!CONFIG_X86_IO_APIC*/
+static inline void mp_config_ioapic_for_sci(int irq) { }
+#endif /*!CONFIG_X86_IO_APIC*/
+
+#endif /*CONFIG_ACPI_BOOT*/
 
 #endif
 
index 1f3692f11483120f1e3ecc9c4ce149a84e16db60..34c69c7aa435d17ee94c71d093949893106c3a5e 100644 (file)
@@ -14,15 +14,16 @@ extern unsigned int pcibios_assign_all_busses(void);
 #else
 #define pcibios_assign_all_busses()    0
 #endif
+#define pcibios_scan_all_fns()         0
 
 extern unsigned long pci_mem_start;
 #define PCIBIOS_MIN_IO         0x1000
 #define PCIBIOS_MIN_MEM                (pci_mem_start)
 
-extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg,
-                              int len, u32 *value);
-extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg,
-                               int len, u32 value);
+void pcibios_config_init(void);
+struct pci_bus * pcibios_scan_root(int bus);
+extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value);
+extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value);
 
 void pcibios_set_master(struct pci_dev *dev);
 void pcibios_penalize_isa_irq(int irq);
index 0cb108c3cea8b4c742a2baabb50ade0e37569ac2..cbce688e8b339dc45522b1001c031b3464df097e 100644 (file)
@@ -32,13 +32,24 @@ struct task_struct;
  */
 
 struct cpuinfo_x86 {
-    __u8       x86;            /* CPU family */
-    __u8       x86_vendor;     /* CPU vendor */
-    __u8       x86_model;
-    __u8       x86_mask;
-    int        cpuid_level;    /* Maximum supported CPUID level, -1=no CPUID */
-    __u32      x86_capability[NCAPINTS];
+    __u8    x86;            /* CPU family */
+    __u8    x86_vendor;     /* CPU vendor */
+    __u8    x86_model;
+    __u8    x86_mask;
+    char    wp_works_ok;    /* It doesn't on 386's */
+    char    hlt_works_ok;   /* Problems on some 486Dx4's and old 386's */
+    char    hard_math;
+    char    rfu;
+    int     cpuid_level;    /* Maximum supported CPUID level, -1=no CPUID */
+    __u32   x86_capability[NCAPINTS];
     char    x86_vendor_id[16];
+    char    x86_model_id[64];
+    int     x86_cache_size;  /* in KB - valid for CPUS which support this
+                                call  */
+    int     fdiv_bug;
+    int     f00f_bug;
+    int     coma_bug;
+    unsigned long loops_per_jiffy;
     unsigned long *pgd_quick;
     unsigned long *pmd_quick;
     unsigned long *pte_quick;
@@ -53,6 +64,8 @@ struct cpuinfo_x86 {
 #define X86_VENDOR_CENTAUR 5
 #define X86_VENDOR_RISE 6
 #define X86_VENDOR_TRANSMETA 7
+#define X86_VENDOR_NSC 8
+#define X86_VENDOR_SIS 9
 #define X86_VENDOR_UNKNOWN 0xff
 
 /*
@@ -70,16 +83,7 @@ extern struct cpuinfo_x86 cpu_data[];
 #define current_cpu_data boot_cpu_data
 #endif
 
-#define cpu_has_pge    (test_bit(X86_FEATURE_PGE,  boot_cpu_data.x86_capability))
-#define cpu_has_pse    (test_bit(X86_FEATURE_PSE,  boot_cpu_data.x86_capability))
-#define cpu_has_pae    (test_bit(X86_FEATURE_PAE,  boot_cpu_data.x86_capability))
-#define cpu_has_tsc    (test_bit(X86_FEATURE_TSC,  boot_cpu_data.x86_capability))
-#define cpu_has_de     (test_bit(X86_FEATURE_DE,   boot_cpu_data.x86_capability))
-#define cpu_has_vme    (test_bit(X86_FEATURE_VME,  boot_cpu_data.x86_capability))
-#define cpu_has_fxsr   (test_bit(X86_FEATURE_FXSR, boot_cpu_data.x86_capability))
-#define cpu_has_xmm    (test_bit(X86_FEATURE_XMM,  boot_cpu_data.x86_capability))
-#define cpu_has_fpu    (test_bit(X86_FEATURE_FPU,  boot_cpu_data.x86_capability))
-#define cpu_has_apic   (test_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability))
+extern char ignore_irq13;
 
 extern void identify_cpu(struct cpuinfo_x86 *);
 extern void print_cpu_info(struct cpuinfo_x86 *);
@@ -190,7 +194,6 @@ static inline unsigned int cpuid_edx(unsigned int op)
        __asm__("movl %0,%%cr0": :"r" (x));
 
 
-
 /*
  * Intel CPU features in CR4
  */
@@ -206,6 +209,9 @@ static inline unsigned int cpuid_edx(unsigned int op)
 #define X86_CR4_OSFXSR         0x0200  /* enable fast FPU save and restore */
 #define X86_CR4_OSXMMEXCPT     0x0400  /* enable unmasked SSE exceptions */
 
+#define load_cr3(pgdir) \
+       asm volatile("movl %0,%%cr3": :"r" (__pa(pgdir)));
+
 /*
  * Save the cr4 feature set we're using (ie
  * Pentium 4MB enable and PPro Global page
@@ -287,6 +293,7 @@ extern unsigned int mca_pentium_flag;
  * Size of io_bitmap in longwords: 32 is ports 0-0x3ff.
  */
 #define IO_BITMAP_SIZE 32
+#define IO_BITMAP_BYTES (IO_BITMAP_SIZE * 4)
 #define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap)
 #define INVALID_IO_BITMAP_OFFSET 0x8000
 
@@ -299,6 +306,7 @@ struct i387_fsave_struct {
     long       foo;
     long       fos;
     long       st_space[20];   /* 8*10 bytes for each FP-reg = 80 bytes */
+    long       status;         /* software status information */
 };
 
 struct i387_fxsave_struct {
@@ -317,9 +325,24 @@ struct i387_fxsave_struct {
     long       padding[56];
 } __attribute__ ((aligned (16)));
 
+struct i387_soft_struct {
+    long    cwd;
+    long    swd;
+    long    twd;
+    long    fip;
+    long    fcs;
+    long    foo;
+    long    fos;
+    long    st_space[20];   /* 8*10 bytes for each FP-reg = 80 bytes */
+    unsigned char   ftop, changed, lookahead, no_update, rm, alimit;
+    struct info     *info;
+    unsigned long   entry_eip;
+};
+
 union i387_union {
     struct i387_fsave_struct   fsave;
     struct i387_fxsave_struct  fxsave;
+    struct i387_soft_struct soft;
 };
 
 typedef struct {
index 72208d2db1fa4e274c99b2efc40b1b503ccc10d9..b48bbae43c2be50f65922ad829b37ed854bbf050 100644 (file)
@@ -1,16 +1,30 @@
 #ifndef __ASM_SMP_H
 #define __ASM_SMP_H
 
+/*
+ * We need the APIC definitions automatically as part of 'smp.h'
+ */
+#ifndef __ASSEMBLY__
 #include <xen/config.h>
+/*#include <xen/threads.h>*/
 #include <asm/ptrace.h>
+#endif
 
-#ifdef CONFIG_SMP
-#define TARGET_CPUS cpu_online_map
-#else
-#define TARGET_CPUS 0x01
+#ifdef CONFIG_X86_LOCAL_APIC
+#ifndef __ASSEMBLY__
+#include <asm/fixmap.h>
+#include <asm/bitops.h>
+#include <asm/mpspec.h>
+#ifdef CONFIG_X86_IO_APIC
+#include <asm/io_apic.h>
+#endif
+#include <asm/apic.h>
+#endif
 #endif
 
 #ifdef CONFIG_SMP
+#ifndef __ASSEMBLY__
+
 /*
  * Private routines/data
  */
@@ -20,8 +34,12 @@ extern unsigned long phys_cpu_present_map;
 extern unsigned long cpu_online_map;
 extern volatile unsigned long smp_invalidate_needed;
 extern int pic_mode;
+extern int smp_num_siblings;
+extern int cpu_sibling_map[];
+
 extern void smp_flush_tlb(void);
 extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs);
+extern void smp_send_reschedule(int cpu);
 extern void smp_invalidate_rcv(void);          /* Process an NMI */
 extern void (*mtrr_hook) (void);
 extern void zap_low_mappings (void);
@@ -54,6 +72,7 @@ extern volatile int logical_apicid_to_cpu[MAX_APICID];
  * General functions that each host system must provide.
  */
  
+/*extern void smp_boot_cpus(void);*/
 extern void smp_store_cpu_info(int id);                /* Store per CPU info (like the initial udelay numbers */
 
 /*
@@ -64,9 +83,6 @@ extern void smp_store_cpu_info(int id);               /* Store per CPU info (like the initial
 
 #define smp_processor_id() (current->processor)
 
-#include <asm/fixmap.h>
-#include <asm/apic.h>
-
 static __inline int hard_smp_processor_id(void)
 {
        /* we don't want to mark this access volatile - bad code generation */
@@ -79,5 +95,21 @@ static __inline int logical_smp_processor_id(void)
        return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR));
 }
 
+#endif /* !__ASSEMBLY__ */
+
+#define NO_PROC_ID             0xFF            /* No processor magic marker */
+
+/*
+ *     This magic constant controls our willingness to transfer
+ *     a process across CPUs. Such a transfer incurs misses on the L1
+ *     cache, and on a P6 or P5 with multiple L2 caches L2 hits. My
+ *     gut feeling is this will vary by board in value. For a board
+ *     with separate L2 cache it probably depends also on the RSS, and
+ *     for a board with shared L2 cache it ought to decay fast as other
+ *     processes are run.
+ */
+#define PROC_CHANGE_PENALTY    15              /* Schedule penalty */
+
 #endif
 #endif
index 4017902c6942fad9390975615699cfd611465012..7a0b1571147c5b730424ac29e963b62d29275ca2 100644 (file)
@@ -29,8 +29,11 @@ static inline void detect_clustered_apic(char* oem, char* prod)
                esr_disable = 1;
                /*Start cyclone clock*/
                cyclone_setup(0);
-       }
-       else if (!strncmp(oem, "IBM ENSW", 8) && !strncmp(prod, "RUTHLESS SMP", 9)){
+       /* check for ACPI tables */
+       } else if (!strncmp(oem, "IBM", 3) &&
+           (!strncmp(prod, "SERVIGIL", 8) ||
+            !strncmp(prod, "EXA", 3) ||
+            !strncmp(prod, "RUTHLESS", 8))){
                clustered_apic_mode = CLUSTERED_APIC_XAPIC;
                apic_broadcast_id = APIC_BROADCAST_ID_XAPIC;
                int_dest_addr_mode = APIC_DEST_PHYSICAL;
@@ -38,8 +41,7 @@ static inline void detect_clustered_apic(char* oem, char* prod)
                esr_disable = 1;
                /*Start cyclone clock*/
                cyclone_setup(0);
-       }
-       else if (!strncmp(oem, "IBM NUMA", 8)){
+       } else if (!strncmp(oem, "IBM NUMA", 8)){
                clustered_apic_mode = CLUSTERED_APIC_NUMAQ;
                apic_broadcast_id = APIC_BROADCAST_ID_APIC;
                int_dest_addr_mode = APIC_DEST_LOGICAL;
@@ -125,6 +127,6 @@ static inline int target_cpus(void)
        return cpu_online_map;
 }
 #else
-#define target_cpus() (0xFF)
+#define target_cpus() (cpu_online_map)
 #endif
 #endif
index 40145ddb0f39104bbb352507222c389464d62e50..ed3a15bfb20cbbaab4f2fd8a91ef7bfdb3cbc25d 100644 (file)
@@ -18,6 +18,4 @@
 
 typedef s64 s_time_t;  /* system time */
 
-extern int using_apic_timer;
-
 #endif /* _ASM_TIME_H_ */
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
new file mode 100644 (file)
index 0000000..feda090
--- /dev/null
@@ -0,0 +1,436 @@
+/*
+ * acpi.h - ACPI Interface
+ *
+ * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#ifndef _LINUX_ACPI_H
+#define _LINUX_ACPI_H
+
+#ifndef _LINUX
+#define _LINUX
+#endif
+
+#include <xen/list.h>
+
+#include <acpi/acpi.h>
+#include <acpi/acpi_bus.h>
+#include <acpi/acpi_drivers.h>
+#include <asm/acpi.h>
+
+
+#ifdef CONFIG_ACPI_BOOT
+
+enum acpi_irq_model_id {
+       ACPI_IRQ_MODEL_PIC = 0,
+       ACPI_IRQ_MODEL_IOAPIC,
+       ACPI_IRQ_MODEL_IOSAPIC,
+       ACPI_IRQ_MODEL_COUNT
+};
+
+extern enum acpi_irq_model_id  acpi_irq_model;
+
+
+/* Root System Description Pointer (RSDP) */
+
+struct acpi_table_rsdp {
+       char                    signature[8];
+       u8                      checksum;
+       char                    oem_id[6];
+       u8                      revision;
+       u32                     rsdt_address;
+} __attribute__ ((packed));
+
+struct acpi20_table_rsdp {
+       char                    signature[8];
+       u8                      checksum;
+       char                    oem_id[6];
+       u8                      revision;
+       u32                     rsdt_address;
+       u32                     length;
+       u64                     xsdt_address;
+       u8                      ext_checksum;
+       u8                      reserved[3];
+} __attribute__ ((packed));
+
+typedef struct {
+       u8                      type;
+       u8                      length;
+} __attribute__ ((packed)) acpi_table_entry_header;
+
+/* Root System Description Table (RSDT) */
+
+struct acpi_table_rsdt {
+       struct acpi_table_header header;
+       u32                     entry[1];
+} __attribute__ ((packed));
+
+/* Extended System Description Table (XSDT) */
+
+struct acpi_table_xsdt {
+       struct acpi_table_header header;
+       u64                     entry[1];
+} __attribute__ ((packed));
+
+/* Fixed ACPI Description Table (FADT) */
+
+struct acpi_table_fadt {
+       struct acpi_table_header header;
+       u32 facs_addr;
+       u32 dsdt_addr;
+       /* ... */
+} __attribute__ ((packed));
+
+/* Multiple APIC Description Table (MADT) */
+
+struct acpi_table_madt {
+       struct acpi_table_header header;
+       u32                     lapic_address;
+       struct {
+               u32                     pcat_compat:1;
+               u32                     reserved:31;
+       }                       flags;
+} __attribute__ ((packed));
+
+enum acpi_madt_entry_id {
+       ACPI_MADT_LAPIC = 0,
+       ACPI_MADT_IOAPIC,
+       ACPI_MADT_INT_SRC_OVR,
+       ACPI_MADT_NMI_SRC,
+       ACPI_MADT_LAPIC_NMI,
+       ACPI_MADT_LAPIC_ADDR_OVR,
+       ACPI_MADT_IOSAPIC,
+       ACPI_MADT_LSAPIC,
+       ACPI_MADT_PLAT_INT_SRC,
+       ACPI_MADT_ENTRY_COUNT
+};
+
+typedef struct {
+       u16                     polarity:2;
+       u16                     trigger:2;
+       u16                     reserved:12;
+} __attribute__ ((packed)) acpi_interrupt_flags;
+
+struct acpi_table_lapic {
+       acpi_table_entry_header header;
+       u8                      acpi_id;
+       u8                      id;
+       struct {
+               u32                     enabled:1;
+               u32                     reserved:31;
+       }                       flags;
+} __attribute__ ((packed));
+
+struct acpi_table_ioapic {
+       acpi_table_entry_header header;
+       u8                      id;
+       u8                      reserved;
+       u32                     address;
+       u32                     global_irq_base;
+} __attribute__ ((packed));
+
+struct acpi_table_int_src_ovr {
+       acpi_table_entry_header header;
+       u8                      bus;
+       u8                      bus_irq;
+       u32                     global_irq;
+       acpi_interrupt_flags    flags;
+} __attribute__ ((packed));
+
+struct acpi_table_nmi_src {
+       acpi_table_entry_header header;
+       acpi_interrupt_flags    flags;
+       u32                     global_irq;
+} __attribute__ ((packed));
+
+struct acpi_table_lapic_nmi {
+       acpi_table_entry_header header;
+       u8                      acpi_id;
+       acpi_interrupt_flags    flags;
+       u8                      lint;
+} __attribute__ ((packed));
+
+struct acpi_table_lapic_addr_ovr {
+       acpi_table_entry_header header;
+       u8                      reserved[2];
+       u64                     address;
+} __attribute__ ((packed));
+
+struct acpi_table_iosapic {
+       acpi_table_entry_header header;
+       u8                      id;
+       u8                      reserved;
+       u32                     global_irq_base;
+       u64                     address;
+} __attribute__ ((packed));
+
+struct acpi_table_lsapic {
+       acpi_table_entry_header header;
+       u8                      acpi_id;
+       u8                      id;
+       u8                      eid;
+       u8                      reserved[3];
+       struct {
+               u32                     enabled:1;
+               u32                     reserved:31;
+       }                       flags;
+} __attribute__ ((packed));
+
+struct acpi_table_plat_int_src {
+       acpi_table_entry_header header;
+       acpi_interrupt_flags    flags;
+       u8                      type;   /* See acpi_interrupt_type */
+       u8                      id;
+       u8                      eid;
+       u8                      iosapic_vector;
+       u32                     global_irq;
+       u32                     reserved;
+} __attribute__ ((packed));
+
+enum acpi_interrupt_id {
+       ACPI_INTERRUPT_PMI      = 1,
+       ACPI_INTERRUPT_INIT,
+       ACPI_INTERRUPT_CPEI,
+       ACPI_INTERRUPT_COUNT
+};
+
+#define        ACPI_SPACE_MEM          0
+
+struct acpi_gen_regaddr {
+       u8  space_id;
+       u8  bit_width;
+       u8  bit_offset;
+       u8  resv;
+       u32 addrl;
+       u32 addrh;
+} __attribute__ ((packed));
+
+struct acpi_table_hpet {
+       struct acpi_table_header header;
+       u32 id;
+       struct acpi_gen_regaddr addr;
+       u8 number;
+       u16 min_tick;
+       u8 page_protect;
+} __attribute__ ((packed));
+
+/*
+ * System Resource Affinity Table (SRAT)
+ *   see http://www.microsoft.com/hwdev/design/srat.htm
+ */
+
+struct acpi_table_srat {
+       struct acpi_table_header header;
+       u32                     table_revision;
+       u64                     reserved;
+} __attribute__ ((packed));
+
+enum acpi_srat_entry_id {
+       ACPI_SRAT_PROCESSOR_AFFINITY = 0,
+       ACPI_SRAT_MEMORY_AFFINITY,
+       ACPI_SRAT_ENTRY_COUNT
+};
+
+struct acpi_table_processor_affinity {
+       acpi_table_entry_header header;
+       u8                      proximity_domain;
+       u8                      apic_id;
+       struct {
+               u32                     enabled:1;
+               u32                     reserved:31;
+       }                       flags;
+       u8                      lsapic_eid;
+       u8                      reserved[7];
+} __attribute__ ((packed));
+
+struct acpi_table_memory_affinity {
+       acpi_table_entry_header header;
+       u8                      proximity_domain;
+       u8                      reserved1[5];
+       u32                     base_addr_lo;
+       u32                     base_addr_hi;
+       u32                     length_lo;
+       u32                     length_hi;
+       u32                     memory_type;    /* See acpi_address_range_id */
+       struct {
+               u32                     enabled:1;
+               u32                     hot_pluggable:1;
+               u32                     reserved:30;
+       }                       flags;
+       u64                     reserved2;
+} __attribute__ ((packed));
+
+enum acpi_address_range_id {
+       ACPI_ADDRESS_RANGE_MEMORY = 1,
+       ACPI_ADDRESS_RANGE_RESERVED = 2,
+       ACPI_ADDRESS_RANGE_ACPI = 3,
+       ACPI_ADDRESS_RANGE_NVS  = 4,
+       ACPI_ADDRESS_RANGE_COUNT
+};
+
+/*
+ * System Locality Information Table (SLIT)
+ *   see http://devresource.hp.com/devresource/docs/techpapers/ia64/slit.pdf
+ */
+
+struct acpi_table_slit {
+       struct acpi_table_header header;
+       u64                     localities;
+       u8                      entry[1];       /* real size = localities^2 */
+} __attribute__ ((packed));
+
+/* Smart Battery Description Table (SBST) */
+
+struct acpi_table_sbst {
+       struct acpi_table_header header;
+       u32                     warning;        /* Warn user */
+       u32                     low;            /* Critical sleep */
+       u32                     critical;       /* Critical shutdown */
+} __attribute__ ((packed));
+
+/* Embedded Controller Boot Resources Table (ECDT) */
+
+struct acpi_table_ecdt {
+       struct acpi_table_header        header;
+       struct acpi_generic_address     ec_control;
+       struct acpi_generic_address     ec_data;
+       u32                             uid;
+       u8                              gpe_bit;
+       char                            ec_id[0];
+} __attribute__ ((packed));
+
+/* Table Handlers */
+
+enum acpi_table_id {
+       ACPI_TABLE_UNKNOWN = 0,
+       ACPI_APIC,
+       ACPI_BOOT,
+       ACPI_DBGP,
+       ACPI_DSDT,
+       ACPI_ECDT,
+       ACPI_ETDT,
+       ACPI_FADT,
+       ACPI_FACS,
+       ACPI_OEMX,
+       ACPI_PSDT,
+       ACPI_SBST,
+       ACPI_SLIT,
+       ACPI_SPCR,
+       ACPI_SRAT,
+       ACPI_SSDT,
+       ACPI_SPMI,
+       ACPI_HPET,
+       ACPI_TABLE_COUNT
+};
+
+typedef int (*acpi_table_handler) (unsigned long phys_addr, unsigned long size);
+
+extern acpi_table_handler acpi_table_ops[ACPI_TABLE_COUNT];
+
+typedef int (*acpi_madt_entry_handler) (acpi_table_entry_header *header);
+
+char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
+unsigned long acpi_find_rsdp (void);
+int acpi_boot_init (void);
+int acpi_numa_init (void);
+
+int acpi_table_init (void);
+int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler);
+int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header);
+int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler);
+int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler);
+void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
+void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
+void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
+
+/* the following four functions are architecture-dependent */
+void acpi_numa_slit_init (struct acpi_table_slit *slit);
+void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa);
+void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma);
+void acpi_numa_arch_fixup(void);
+
+#else /*!CONFIG_ACPI_BOOT*/
+
+static inline int acpi_boot_init(void)
+{
+       return 0;
+}
+
+#endif /*!CONFIG_ACPI_BOOT*/
+
+
+#ifdef CONFIG_ACPI_PCI
+
+struct acpi_prt_entry {
+       struct list_head        node;
+       struct acpi_pci_id      id;
+       u8                      pin;
+       struct {
+               acpi_handle             handle;
+               u32                     index;
+       }                       link;
+       u32                     irq;
+};
+
+struct acpi_prt_list {
+       int                     count;
+       struct list_head        entries;
+};
+
+extern struct acpi_prt_list    acpi_prt;
+
+struct pci_dev;
+
+int acpi_pci_irq_enable (struct pci_dev *dev);
+int acpi_pci_irq_init (void);
+
+struct acpi_pci_driver {
+       struct acpi_pci_driver *next;
+       int (*add)(acpi_handle handle);
+       void (*remove)(acpi_handle handle);
+};
+
+int acpi_pci_register_driver(struct acpi_pci_driver *driver);
+void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
+
+#endif /*CONFIG_ACPI_PCI*/
+
+#ifdef CONFIG_ACPI_EC
+
+int ec_read(u8 addr, u8 *val);
+int ec_write(u8 addr, u8 val);
+
+#endif /*CONFIG_ACPI_EC*/
+
+#ifdef CONFIG_ACPI_INTERPRETER
+
+int acpi_blacklisted(void);
+
+#else /*!CONFIG_ACPI_INTERPRETER*/
+
+static inline int acpi_blacklisted(void)
+{
+       return 0;
+}
+
+#endif /*!CONFIG_ACPI_INTERPRETER*/
+
+#endif /*_LINUX_ACPI_H*/
index d25d1ecd21aa1fc3e451c5a1fdd78c3743dcf60d..53fdedb32aa8044ee302d888f9cc4bf6ebd63875 100644 (file)
@@ -520,6 +520,32 @@ struct pci_driver {
        int  (*enable_wake) (struct pci_dev *dev, u32 state, int enable);   /* Enable wake event */
 };
 
+/**
+ * PCI_DEVICE - macro used to describe a specific pci device
+ * @vend: the 16 bit PCI Vendor ID
+ * @dev: the 16 bit PCI Device ID
+ *
+ * This macro is used to create a struct pci_device_id that matches a
+ * specific device.  The subvendor and subdevice fields will be set to
+ * PCI_ANY_ID.
+ */
+#define PCI_DEVICE(vend,dev) \
+       .vendor = (vend), .device = (dev), \
+       .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
+
+/**
+ * PCI_DEVICE_CLASS - macro used to describe a specific pci device class
+ * @dev_class: the class, subclass, prog-if triple for this device
+ * @dev_class_mask: the class mask for this device
+ *
+ * This macro is used to create a struct pci_device_id that matches a
+ * specific PCI class.  The vendor, device, subvendor, and subdevice 
+ * fields will be set to PCI_ANY_ID.
+ */
+#define PCI_DEVICE_CLASS(dev_class,dev_class_mask) \
+       .class = (dev_class), .class_mask = (dev_class_mask), \
+       .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
+       .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
 
 /* these external functions are only available when PCI support is enabled */
 #ifdef CONFIG_PCI
@@ -602,7 +628,6 @@ void pci_set_master(struct pci_dev *dev);
 #define HAVE_PCI_SET_MWI
 int pci_set_mwi(struct pci_dev *dev);
 void pci_clear_mwi(struct pci_dev *dev);
-int pdev_set_mwi(struct pci_dev *dev);
 int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
 int pci_dac_set_dma_mask(struct pci_dev *dev, u64 mask);
 int pci_assign_resource(struct pci_dev *dev, int i);
index d29b7099214222f8312b077cc268a69d305cafdb..ee352a9cb5d416b353a806d940a3e508c465d0c2 100644 (file)
 #define PCI_DEVICE_ID_MIRO_36050       0x5601
 
 #define PCI_VENDOR_ID_NEC              0x1033
+#define PCI_DEVICE_ID_NEC_NAPCCARD     0x003e
 #define PCI_DEVICE_ID_NEC_PCX2         0x0046
 #define PCI_DEVICE_ID_NEC_NILE4                0x005a
 #define PCI_DEVICE_ID_NEC_VRC5476       0x009b
+#define PCI_DEVICE_ID_NEC_VRC4173      0x00a5
 #define PCI_DEVICE_ID_NEC_VRC5477_AC97  0x00a6
 
 #define PCI_VENDOR_ID_FD               0x1036
 #define PCI_VENDOR_ID_ITE              0x1283
 #define PCI_DEVICE_ID_ITE_IT8172G      0x8172
 #define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801
+#define PCI_DEVICE_ID_ITE_IT8181       0x8181
 #define PCI_DEVICE_ID_ITE_8872         0x8872
 
 #define PCI_DEVICE_ID_ITE_IT8330G_0    0xe886
 #define PCI_DEVICE_ID_TIGON3_5702      0x1646
 #define PCI_DEVICE_ID_TIGON3_5703      0x1647
 #define PCI_DEVICE_ID_TIGON3_5704      0x1648
+#define PCI_DEVICE_ID_TIGON3_5704S_2   0x1649
 #define PCI_DEVICE_ID_TIGON3_5702FE    0x164d
 #define PCI_DEVICE_ID_TIGON3_5705      0x1653
 #define PCI_DEVICE_ID_TIGON3_5705_2    0x1654
 #define PCI_DEVICE_ID_TIGON3_5705M     0x165d
 #define PCI_DEVICE_ID_TIGON3_5705M_2   0x165e
+#define PCI_DEVICE_ID_TIGON3_5705F     0x166e
 #define PCI_DEVICE_ID_TIGON3_5782      0x1696
 #define PCI_DEVICE_ID_TIGON3_5788      0x169c
 #define PCI_DEVICE_ID_TIGON3_5702X     0x16a6